“Widget:ScenarioSimulator”的版本间的差异

来自PRTS
跳转至: 导航搜索
(Update by bot.)
 
(未显示3个用户的665个中间版本)
第1行: 第1行:
<noinclude>{{#Widget:Krliov/test2|pic_back={{用户:Krliov/testpage3}}|pic_char={{用户:Krliov/testpage4}}|datas=
+
<noinclude>{{Cbox2|title=提示|lv=0|icon=edit|text=如果您需要了解这个小部件的更新日志,请查看[[User:Krliov/ScenarioSimulator_Update_Log|剧情模拟器更新日志]]}}{{#Widget:ScenarioSimulator|data_txt={{用户:Krliov/testpage5}}|data_back={{Widget:Data_Image}}|data_char={{Widget:Data_Char}}|data_audio={{Widget:Data_Audio}}|data_override={{Widget:Data_Override}}|data_link={{Widget:Data_Link}}|data_name={{DrName}}}}</noinclude>
[back]bg_cher_1
+
<includeonly>
[char]char_130_doberm_ex
+
<div id="system_main">
杜宾:可恶……
+
<div class="button_style" id="button_auto" style="right:144px;" onclick="txt_auto()">自动▶</div>
这里,究竟怎么了?
+
<div class="button_style" id="button_reset" style="right:0px;color:#808080;" onclick="txt_reset()">重置▶</div>
[clear_char]
+
<div class="playback_style" id="button_playback" style="display:block;background-image:url('//ak.mooncell.wiki/images/1/17/Avg_btn_playback.png');background-repeat:no-repeat;background-size:45px 38px;" onclick="txt_playback('show')"></div>
[back]avg_2_2
+
<div class="playback_style" id="button_playback_return" style="display:none;text-align:center;color:white;font-size:25px;" onclick="txt_playback('hide')">◀</div>
整合运动成员:这边的屋子,也都给我搜干净!
+
<div class="common_style" id="system_blocker" onclick="txt_click()"></div>
女性:放开他……不!你们……
+
<div class="common_style" id="system_camera">
整合运动成员:反抗?太迟了!可恨的切尔诺伯格人!
+
<div class="common_style" id="pic_back"></div>
男性:快跑!不要管我......孩子就......
+
<div class="common_style" id="pic_char"></div>
孩童:妈妈……妈妈……!
+
<div class="common_style" id="pic_item"></div>
}}</noinclude>
+
<div class="common_style" id="pic_image"></div>
<includeonly><div style="position:relative;width:800px;height:450px;background-color:#000000;" onclick="txt_start()" id="system_main">
+
<div class="common_style" id="pic_cutin"></div>
<div class="button_style" id="button_auto" style="right:100px;" onclick="txt_auto()">自动▶</div>
+
</div>
<div class="button_style" id="button_reset" style="right:0px;color:#808080;" onclick="txt_reset()">重置▶</div>
+
<div class="common_style" id="system_playback" style="display:none;">
<div class="pic_style" id="pic_back" style="display:none;" onclick="txt_click(1)"></div>
+
<ul id="playback_result"></ul>
<div class="pic_style" id="pic_image" style="display:none;" onclick="txt_click(2)"></div>
+
</div>
<div class="char_style" id="pic_char_1" style="display:none;" onclick="txt_click(11)">
+
<div id="system_decision" style="display:none;">
<div id="pic_char" style="float:left;position:absolute;left:200px;top:25px;width:400px;height:400px;"></div></div>
+
<div class="decision_style" id="decision_1" style="top:144px;display:block;" onclick="txt_decision(0)">...</div>
<div class="char_style" id="pic_char_2" style="display:none;" onclick="txt_click(12)">
+
<div class="decision_style" id="decision_2" style="top:216px;display:block;" onclick="txt_decision(1)">....</div>
<div id="pic_char_left" style="float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;"></div>
+
<div class="decision_style" id="decision_3" style="top:288px;display:block;" onclick="txt_decision(2)">.....</div>
<div id="pic_char_right" style="float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;"></div></div>
+
</div>
<div class="dialog_style" id="dialog_main" style="display:block;" onclick="txt_click()">
+
<div id="system_dialog" style="display:block;" onclick="txt_click()">
<div style="position:absolute;text-align:right;width:150px;height:60px;padding:5px 10px 0px 10px;color:#929292;font-size:18px;" id="txt_name">剧情模拟器</div>
+
<div class="dialog_style" id="txt_name">剧情模拟器</div>
<div style="float:right;height:60px;width:600px;background-color:rgba(0,0,0,.85);padding:5px 10px 0px 10px;color:white;font-size:15px;" id="txt_output">单击开始剧情回顾</div>
+
<div class="dialog_style" id="txt_output">单击开始剧情回顾</div>
</div>
+
</div>
</div>
+
</div>
 +
<audio id="system_music" hidden>
 +
</audio>
 +
<div id="system_audio" style="display:none;"></div>
 
<style>
 
<style>
.char_style{
 
z-index:2;
 
background-clip:"padding-box";
 
}
 
#pic_image{
 
z-index:2;
 
}
 
 
.button_style{
 
.button_style{
z-index:2;
+
z-index:4;
 
position:absolute;
 
position:absolute;
 
float:right;
 
float:right;
 
color:white;
 
color:white;
width:100px;
+
width:120px;
height:20px;
+
height:24px;
font-size:14px;
+
font-size:18px;
top:20px;
+
top:24px;
padding:0px 5px;
+
padding:0px 6px;
 
text-align:left;
 
text-align:left;
 +
cursor:default;
 +
user-select:none;
 +
}
 +
.common_style{
 +
position:absolute;
 +
width:960px;
 +
height:540px;
 +
}
 +
.cutin_style{
 +
position:absolute;
 +
background-repeat:no-repeat;
 +
background-position:top;
 +
background-color: grey;
 
}
 
}
 
.pic_style{
 
.pic_style{
z-index:1;
+
position:absolute;
width:800px;
+
width:960px;
height:450px;
+
height:540px;
 +
background-repeat:no-repeat;
 +
}
 +
.item_style{
 +
position:absolute;
 +
border:7.5px solid white;
 +
background-repeat:no-repeat;
 +
}
 +
.decision_style{
 +
z-index:4;
 +
position:absolute;
 +
width:300px;
 +
height:36px;
 +
font-size:18px;
 +
left:348px;
 +
padding:6px 12px 0px 12px;
 +
border:solid 2.4px white;
 +
text-align:center;
 +
color:white;
 +
background-color:#303030;
 +
cursor:default;
 +
user-select:none;
 
}
 
}
 
.dialog_style{
 
.dialog_style{
 +
z-index:4;
 +
position:absolute;
 +
height:96px;
 +
bottom:0px;
 +
color:white;
 +
background-image:linear-gradient(rgba(0,0,0,0),black 40%);
 +
cursor:default;
 +
user-select:none;
 +
}
 +
#txt_name{
 +
padding:40px 15px 0px 45px;
 +
font-size:21px;
 +
left:0px;
 +
width:200px;
 +
text-align:right;
 +
color:#929292;
 +
}
 +
#txt_output{
 +
padding:40px 70px 0px 15px;
 +
font-size:18px;
 +
right:0px;
 +
width:615px;
 +
}
 +
.playback_style{
 +
z-index:6;
 +
position:absolute;
 +
top:24px;
 +
left:24px;
 +
width:45px;
 +
height:45px;
 +
cursor:default;
 +
user-select:none;
 +
}
 +
#playback_result{
 +
position:absolute;
 +
list-style-type:none;
 +
list-style-image:none;
 +
left:180px;
 +
top:30px;
 +
width:700px;
 +
}
 +
#pic_back{
 +
z-index:0;
 +
}
 +
#pic_image,#pic_cutin,#pic_item{
 
z-index:2;
 
z-index:2;
position:absolute;
+
}
width:790px;
+
#pic_char{
right:5px;
+
z-index:1;
bottom:5px;
+
}
background-color:rgba(0,0,0,.8);
+
#system_blocker{
 +
z-index:3;
 +
background-color:rgb(0,0,0);
 +
user-select:none;
 +
}
 +
#system_camera{
 +
overflow:hidden;
 +
}
 +
#system_main{
 +
position: relative;
 +
width:960px;
 +
height:540px;
 +
background-color:#000000;
 +
transition:all 0.05s linear 0s;
 +
}
 +
#system_playback{
 +
z-index:5;
 +
background-color:rgba(0,0,0,0.9);
 +
overflow-y:auto;
 +
cursor:default;
 +
user-select:none;
 +
}
 +
#system_playback li{
 +
padding:5px 0px 5px 0px;
 +
height:20px;
 +
}
 +
#system_playback em{
 +
float:left;
 +
color:#929292;
 +
font-size:16px;
 +
font-style:unset;
 +
padding-right:10px;
 +
width:100px;
 +
text-align:left;
 +
}
 +
#system_playback span{
 +
float:left;
 +
color:white;
 +
font-size:14px;
 +
padding-left:10px;
 +
width:580px;
 +
text-align:left;
 +
}
 +
#system_playback li:nth-last-child(1) em,#system_playback li:nth-last-child(1) span{
 +
color:gold;
 +
}
 +
@keyframes fade-in{
 +
0%{
 +
opacity:0;
 +
}
 +
100%{
 +
opacity:1;
 +
}
 +
}
 +
@keyframes fade-out{
 +
0%{
 +
opacity:1;
 +
}
 +
100%{
 +
opacity:0;
 +
}
 
}
 
}
 
</style>
 
</style>
<script type="csv" id="datas_txt"><!--{$datas}--></script>
+
<script type="csv" id="datas_txt"><!--{$data_txt}--></script>
<script type="csv" id="datas_back"><!--{$pic_back}--></script>
+
<script type="csv" id="datas_back"><!--{$data_back}--></script>
<script type="csv" id="datas_char"><!--{$pic_char}--></script>
+
<script type="csv" id="datas_char"><!--{$data_char}--></script>
 +
<script type="csv" id="datas_audio"><!--{$data_audio}--></script>
 +
<script type="json" id="datas_link"><!--{$data_link}--></script>
 +
<script type="csv" id="datas_override"><!--{$data_override}--></script>
 +
<script src="https://s3.pstatp.com/cdn/expire-1-M/PreloadJS/1.0.1/preloadjs.min.js" type="application/javascript"></script>
 
<script>
 
<script>
//(window.RLQ = window.RLQ || []).push(function () {
+
var txt_max = 0,txt_num = 0,now_txt = "",now_txt_max = 0,now_txt_num = 0,now_txt_temp = "";
//$(document).ready(function() {
+
var timer_id = [];
var txt_now = 0,txt_num = 0,txt_num_max = 0,now_txt = "";
+
var flag_auto = false;
var timer_id,flag_timer = false;
+
var blocker_now = 1,blocker_new = 0;
var timer_id_auto,timer_id_wait,flag_auto = false;
+
var data_image = [],data_back = [],data_cutin = [];
var reset_enabled = false,auto_enabled = true,click_enabled = true,system_enabled = true;
+
var music_loop = "",music_volume = 0.8;
 +
var shake_times = 0;
 +
var reset_enabled = false,click_enabled = true;
 
var auto_num = 0;
 
var auto_num = 0;
var txt_temp = "";
 
 
var data_temp = "";
 
var data_temp = "";
var data_txt = {};
+
var data_nickname = "<!--{$data_name}-->";
var data_pic_back = {};
+
var decision_value = [-1,-1,-1];
var data_pic_char = {};
+
var decision_mode = false,decision_select = 1;
try
+
var data_txt = [];
 +
var data_pic_back = [];
 +
var data_pic_char = [];
 +
var data_override = [];
 +
data_override.title = [];data_override.char = [];data_override.image = [];data_override.tween = [];data_override.override = [];
 +
var data_audio = [];
 +
var data_link;
 +
var queue = new createjs.LoadQueue(false);
 +
//debug setting
 +
var txt_page_name = "";
 +
var txt_interval = 25,txt_delay_per = 100,txt_delay_all = 1200;
 +
data_temp = document.getElementById("datas_override").innerHTML;
 +
for (let temp_s1 of data_temp.split("\n"))
 
{
 
{
if(debug == true)
+
if(temp_s1 == "" || temp_s1.match("^\\s+$") || temp_s1.match("^\\s*//.*$")){continue;}
 +
let temp_array = temp_s1.match("(.*?)\\:(.*)");
 +
if(temp_array == undefined){continue;}
 +
else if(temp_array[2] == undefined){continue;}
 +
let temp_d1,temp_d2,temp_d3,temp_d4;
 +
let temp_a1 = [],temp_a2 = [];
 +
switch(temp_array[1].toLowerCase())
 
{
 
{
data_temp = document.getElementById("datas_txt_temp").innerHTML;
+
case 'title':
 +
[temp_d1,temp_d2] = temp_array[2].split("=");
 +
if(temp_d2 == undefined){continue;}
 +
data_override.title[temp_d1] = temp_d2;
 +
break;
 +
case 'char':
 +
[temp_d1,temp_d2] = temp_array[2].split(";");
 +
[temp_d3,temp_d4] = temp_d1.split("=");
 +
if(temp_d4 == undefined){continue;}
 +
data_override.char[temp_d3] = [];
 +
data_override.char[temp_d3].name = temp_d4;
 +
if(temp_d2 == undefined)
 +
{
 +
data_override.char[temp_d3].limit = "none";
 +
}
 +
else
 +
{
 +
data_override.char[temp_d3].limit = "true";
 +
for(let temp_s2 of temp_d2.split(","))
 +
{
 +
let [p,v] = temp_s2.split("=");
 +
data_override.char[temp_d3][p] = v;
 +
}
 +
}
 +
break;
 +
case 'image':
 +
[temp_d1,temp_d2] = temp_array[2].split(";");
 +
[temp_d3,temp_d4] = temp_d1.split(",");
 +
temp_a1 = temp_d4.split(".");
 +
if(temp_a1.length == 0 || temp_d2 == undefined){continue;}
 +
if(data_override.image[temp_d3] == undefined)
 +
{
 +
data_override.image[temp_d3] = [];
 +
}
 +
for(let temp_c1=0;temp_c1<temp_a1.length;temp_c1++)
 +
{
 +
data_override.image[temp_d3]["L" + temp_a1[temp_c1]] = [];
 +
for(let temp_s2 of temp_d2.split(","))
 +
{
 +
let [p,v] = temp_s2.split("=");
 +
data_override.image[temp_d3]["L" + temp_a1[temp_c1]][p] = v;
 +
}
 +
}
 +
break;
 +
case 'tween':
 +
[temp_d1,temp_d2] = temp_array[2].split(";");
 +
[temp_d3,temp_d4] = temp_d1.split(",");
 +
temp_a1 = temp_d4.split(".");
 +
if(temp_a1.length == 0 || temp_d2 == undefined){continue;}
 +
if(data_override.tween[temp_d3] == undefined)
 +
{
 +
data_override.tween[temp_d3] = [];
 +
}
 +
for(let temp_c1=0;temp_c1<temp_a1.length;temp_c1++)
 +
{
 +
data_override.tween[temp_d3]["L" + temp_a1[temp_c1]] = [];
 +
for(let temp_s2 of temp_d2.split(","))
 +
{
 +
let [p,v] = temp_s2.split("=");
 +
data_override.tween[temp_d3]["L" + temp_a1[temp_c1]][p] = v;
 +
}
 +
}
 +
break;
 +
case 'override':
 +
[temp_d1,temp_d2] = temp_array[2].split(";");
 +
[temp_d3,temp_d4] = temp_d1.split(",");
 +
if(temp_d4 == undefined){continue;}
 +
if(data_override.override[temp_d3] == undefined)
 +
{
 +
data_override.override[temp_d3] = [];
 +
}
 +
if(temp_d2 == undefined){temp_d2 = ""};
 +
data_override.override[temp_d3]["L" + temp_d4] = temp_d2;
 +
}
 +
}
 +
console.log(data_override);
 +
data_temp = document.getElementById("firstHeading") == null ? "mobile" : "desktop";
 +
if(data_temp == "desktop")
 +
{
 +
data_temp = document.getElementById("firstHeading").innerHTML;
 +
txt_page_name = data_temp;
 +
if(data_override.title[data_temp] != undefined)
 +
{
 +
document.title = document.title.replace(data_temp,data_override.title[data_temp]);
 +
document.getElementById("firstHeading").innerHTML = data_override.title[data_temp];
 
}
 
}
 
else
 
else
 
{
 
{
data_temp = document.getElementById("datas_txt").innerHTML;
+
document.title = document.title.replace("/BEG"," 行动前").replace("/END"," 行动后").replace(/\/(剧情|NBT)/g," 剧情");
 +
data_temp = data_temp.replace("/BEG"," 行动前").replace("/END"," 行动后").replace(/\/(剧情|NBT)/g," 剧情");
 +
document.getElementById("firstHeading").innerHTML = data_temp;
 
}
 
}
 +
}
 +
else if(data_temp == "mobile")
 +
{
 +
data_temp = document.getElementById("section_0").innerHTML;
 +
txt_page_name = data_temp;
 +
if(data_override.title[data_temp] != undefined)
 +
{
 +
document.title = document.title.replace(data_temp,data_override.title[data_temp]);
 +
document.getElementById("section_0").innerHTML = data_override.title[data_temp];
 +
}
 +
else
 +
{
 +
document.title = document.title.replace("/BEG"," 行动前").replace("/END"," 行动后").replace(/\/(剧情|NBT)/g," 剧情");
 +
data_temp = data_temp.replace("/BEG"," 行动前").replace("/END"," 行动后").replace(/\/(剧情|NBT)/g," 剧情");
 +
document.getElementById("section_0").innerHTML = data_temp;
 +
}
 +
}
 +
try{
 +
data_temp = document.getElementById("datas_txt").innerHTML;
 
data_txt = data_temp.split("\n");
 
data_txt = data_temp.split("\n");
 
}
 
}
catch(err)
+
catch(err){
{
+
console.error("ERROR:The data_txt loaded failed,please check the input and try again.");
console.error("ERROR:The datas loaded failed,please check the input and try again.");
+
data_txt.push('[name="Krliov"]  There has something wrong when loaded data_txt,please check the input. :3');
data_txt.push("Krliov:There has something wrong when loaded datas,please check the input. :3");
+
click_enabled = false;
auto_enabled = false;
+
document.getElementById("button_auto").style.color = "#808080";
system_enabled = false;
 
 
}
 
}
var txt_max = data_txt.length;
+
try{
try
 
{
 
 
data_temp = document.getElementById("datas_back").innerHTML;
 
data_temp = document.getElementById("datas_back").innerHTML;
for (var num of data_temp.split("\n"))
+
for (let temp_s1 of data_temp.split("\n"))
 
{
 
{
var [name,path] = num.split(",");
+
let [p,v] = temp_s1.split(",");
data_pic_back[name] = path;
+
data_pic_back[p] = v;
 
}
 
}
 
}
 
}
catch(err)
+
catch(err){
{
+
console.error("ERROR:The data_back loaded failed,please check the input and try again.");
console.error("ERROR:The pic_back loaded failed,please check the input and try again.");
+
data_txt.push('[name="Krliov"]  There has something wrong when loaded data_back,please check the input. :3');
data_txt.push("Krliov:There has something wrong when loaded pic_back,please check the input. :3");
+
click_enabled = false;
auto_enabled = false;
+
document.getElementById("button_auto").style.color = "#808080";
system_enabled = false;
 
 
}
 
}
try
+
try{
{
 
 
data_temp = document.getElementById("datas_char").innerHTML;
 
data_temp = document.getElementById("datas_char").innerHTML;
for (var num of data_temp.split("\n"))
+
for (let temp_s1 of data_temp.split("\n"))
 +
{
 +
let [p,v] = temp_s1.split(",");
 +
data_pic_char[p] = v;
 +
}
 +
}
 +
catch(err){
 +
console.error("ERROR:The data_char loaded failed,please check the input and try again.");
 +
data_txt.push('[name="Krliov"]  There has something wrong when loaded data_char,please check the input. :3');
 +
click_enabled = false;
 +
document.getElementById("button_auto").style.color = "#808080";
 +
}
 +
try{
 +
data_temp = document.getElementById("datas_audio").innerHTML;
 +
for (let temp_s1 of data_temp.split("\n"))
 
{
 
{
var [name,path] = num.split(",");
+
let [p,v] = temp_s1.split(",");
data_pic_char[name] = path;
+
data_audio[p] = v;
 
}
 
}
 
}
 
}
catch(err)
+
catch(err){
 +
console.error("ERROR:The data_audio loaded failed,please check the input and try again.");
 +
data_txt.push('[name="Krliov"]  There has something wrong when loaded data_audio,please check the input. :3');
 +
click_enabled = false;
 +
document.getElementById("button_auto").style.color = "#808080";
 +
}
 +
data_temp = document.getElementById("datas_link").innerHTML.toLowerCase();
 +
data_link = JSON.parse(data_temp);
 +
var data_need = [];
 +
for (let temp_c1=0;temp_c1<data_txt.length;temp_c1++)
 
{
 
{
console.error("ERROR:The pic_char loaded failed,please check the input and try again.");
+
if(data_override_check('override',txt_page_name,temp_c1))
data_txt.push("Krliov:There has something wrong when loaded pic_char,please check the input. :3");
+
{
auto_enabled = false;
+
let temp_num = temp_c1 + 1;
system_enabled = false;
+
data_txt[temp_c1] = data_override.override[txt_page_name]["L" + temp_num];
 +
}
 +
if(data_txt[temp_c1] == "" || data_txt[temp_c1].match("^\\s+$") || data_txt[temp_c1].match("^\\s*//.*$")){continue;}
 +
let data_command = data_txt[temp_c1].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)");
 +
if (data_command == null){continue;}
 +
if (data_command[1] != undefined)
 +
{
 +
let command_set = [];
 +
data_command[2] = data_command[2].replace(/["'\$]/g,"");
 +
for (let temp_s1 of data_command[2].split(","))
 +
{
 +
let [p,v] = temp_s1.split("=");
 +
if(p==""){continue;}
 +
p=p.toLowerCase().trim();
 +
if(v==undefined){continue;}
 +
command_set[p] = v.trim();
 +
}
 +
let temp_d1,temp_d2,temp_d3,temp_d4;
 +
switch (data_command[1].toLowerCase())
 +
{
 +
case 'background':
 +
temp_d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
if(temp_d1 == ""){continue;}
 +
else if(data_pic_back[temp_d1] == undefined || data_pic_back[temp_d1] == ""){
 +
console.warn("Image Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_back[temp_d1]) == false){data_need.push(data_pic_back[temp_d1]);}
 +
break;
 +
case 'character':
 +
temp_d3 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
 +
temp_d4 = command_set.name2 == undefined ? "" : command_set.name2.toLowerCase();
 +
if (temp_d3 != "")
 +
{
 +
if(data_override_check('char',temp_d3,temp_c1) == true){temp_d3 = data_override.char[temp_d3].name;}
 +
[temp_d1,temp_d2] = fun_char_link(temp_d3);
 +
if(temp_d1 == -1){continue;}
 +
temp_d3 = data_link[temp_d1].array[temp_d2].default;
 +
if(data_pic_char[temp_d3] == undefined || data_pic_char[temp_d3] == ""){
 +
console.warn("Char Data:" + temp_d3 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_char[temp_d3]) == false){data_need.push(data_pic_char[temp_d3]);}
 +
}
 +
if (temp_d4 != "")
 +
{
 +
if(data_override_check('char',temp_d4,temp_c1) == true){temp_d4 = data_override.char[temp_d4].name;}
 +
[temp_d1,temp_d2] = fun_char_link(temp_d4);
 +
if(temp_d1 == -1){continue;}
 +
temp_d4 = data_link[temp_d1].array[temp_d2].default;
 +
if(data_pic_char[temp_d4] == undefined || data_pic_char[temp_d4] == ""){
 +
console.warn("Char Data:" + temp_d4 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_char[temp_d4]) == false){data_need.push(data_pic_char[temp_d4]);}
 +
}
 +
break;
 +
case 'charactercutin':
 +
temp_d1 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
 +
if(temp_d1 != "")
 +
{
 +
[temp_d2,temp_d3] = fun_char_link(temp_d1)
 +
if(temp_d2 == -1){continue;}
 +
temp_d1 = data_link[temp_d2].array[temp_d3].default;
 +
if(data_pic_char[temp_d1] == undefined || data_pic_char[temp_d1] == ""){
 +
console.warn("Char Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_char[temp_d1]) == false){data_need.push(data_pic_char[temp_d1]);}
 +
}
 +
break;
 +
case 'image':
 +
temp_d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
if(temp_d1 != "")
 +
{
 +
if(data_pic_back[temp_d1] == undefined || data_pic_back[temp_d1] == ""){
 +
console.warn("Image Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_back[temp_d1]) == false){data_need.push(data_pic_back[temp_d1]);}
 +
}
 +
break;
 +
case 'playmusic':
 +
temp_d1 = command_set.intro == undefined ? "" : command_set.intro.toLowerCase();
 +
temp_d2 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
if(temp_d1 != "")
 +
{
 +
if(data_audio[temp_d1] == undefined || data_audio[temp_d1] == ""){
 +
console.warn("Audio Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_audio[temp_d1]) == false){data_need.push(data_audio[temp_d1]);}
 +
}
 +
if(temp_d2 != "")
 +
{
 +
if(data_audio[temp_d2] == undefined || data_audio[temp_d2] == ""){
 +
console.warn("Audio Data:" + temp_d2 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_audio[temp_d2]) == false){data_need.push(data_audio[temp_d2]);}
 +
}
 +
break;
 +
case 'playsound':
 +
temp_d1 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
if(temp_d1 != "")
 +
{
 +
if(data_audio[temp_d1] == undefined || data_audio[temp_d1] == ""){
 +
console.warn("Audio Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_audio[temp_d1]) == false){data_need.push(data_audio[temp_d1]);}
 +
}
 +
break;
 +
case 'showitem':
 +
temp_d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
if(temp_d1 == ""){continue;}
 +
else if(data_pic_back[temp_d1] == undefined || data_pic_back[temp_d1] == ""){
 +
console.warn("Item Data:" + temp_d1 + " is not exist,please check the data list.");
 +
continue;
 +
}
 +
else if(data_exist(data_pic_back[temp_d1]) == false){data_need.push(data_pic_back[temp_d1]);}
 +
break;
 +
default:
 +
continue;
 +
}
 +
}
 +
}
 +
for (let num=0;num<data_need.length;num++)
 +
{
 +
console.log("Loading data:" + data_need[num]);
 +
queue.loadFile(data_need[num]);
 
}
 
}
 
console.log(data_txt);
 
console.log(data_txt);
 
console.log(data_pic_back);
 
console.log(data_pic_back);
 
console.log(data_pic_char);
 
console.log(data_pic_char);
//})
+
console.log(data_audio);
//});
+
console.log(data_link);
function txt_start()
+
function txt_click()
{
 
if (system_enabled == false)
 
{
 
// console.log("system didn't passed.");
 
return;
 
}
 
// console.log("system passed.");
 
txt_click(-1);
 
}
 
function txt_click(enter_id)
 
 
{
 
{
 +
if(flag_auto == true){auto_stop();}
 
if(click_enabled == false)
 
if(click_enabled == false)
 
{
 
{
 +
if(mw.config.values.debug==true){console.log("click didn't passed.");}
 
return;
 
return;
 
}
 
}
// console.log("id=" + enter_id);
+
if(mw.config.values.debug==true){console.log("click passed.");}
system_enabled = false;
+
if(txt_num == 0){fun_setting("pre");}
reset_enabled = true;
+
if(reset_enabled == false)
document.getElementById("button_reset").style.color = "";
 
if(flag_auto == true)
 
 
{
 
{
auto_stop();
+
reset_enabled = true;
 +
document.getElementById("button_reset").style.color = "";
 
}
 
}
if(flag_timer == true)
+
if(timer_id.dynamic != undefined)
 
{
 
{
// console.log("The timer has been stopped force.");
+
txt_stop("f");
txt_stop();
+
document.getElementById("txt_output").innerHTML = now_txt;
txt_now--;
 
place = data_txt[txt_now].indexOf(":");
 
var _temp;
 
if (place > 0)
 
{
 
_temp = data_txt[txt_now].substr(place + 1);
 
}
 
else
 
{
 
_temp = data_txt[txt_now];
 
}
 
document.getElementById("txt_output").innerHTML = _temp;
 
txt_now++;
 
 
return;
 
return;
 
}
 
}
第181行: 第570行:
 
function txt_next()
 
function txt_next()
 
{
 
{
var place = -1;
 
 
//before
 
//before
if (txt_now == txt_max)
+
if (txt_num == txt_max)
 
{
 
{
if(flag_auto == true)
+
if(mw.config.values.debug==true){console.log("txt_num=" + txt_num + " ,txt_max=" + txt_max);}
{
+
if(flag_auto == true){auto_stop();}
auto_stop();
+
fun_setting("reset");
}
 
document.getElementById("pic_back").style.display = "none";
 
document.getElementById("pic_char_1").style.display = "none";
 
document.getElementById("pic_char_2").style.display = "none";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
 
document.getElementById("txt_output").innerHTML = "剧情模拟已结束,单击将重新开始剧情回顾";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已结束,单击将重新开始剧情回顾";
system_enabled = true;
 
reset_enabled = false;
 
document.getElementById("button_reset").style.color = "#808080";
 
txt_now = 0;
 
txt_num_max = 0;
 
 
return;
 
return;
 
}
 
}
 
//check
 
//check
var ret = 0;
+
let ret = 0;
if (debug == true)
+
if (mw.config.values.debug == true)
 
{
 
{
ret = txt_check_test();
+
if (data_txt[txt_num] == ""){ret = -2;}
 +
else{ret = txt_check_test();}
 
}
 
}
else if (debug == false)
+
else
 
{
 
{
if (data_txt[txt_now] = "")
+
if (data_txt[txt_num] == ""){ret = -2;}
{
+
else{ret = txt_check();}
console.log("Has skipped the space part.Data number:" + txt_now);
 
txt_now++;
 
txt_next();
 
return;
 
}
 
ret = txt_check();
 
 
}
 
}
 
if(ret == -2)
 
if(ret == -2)
 
{
 
{
console.log("Break and wait timer.");
+
if(mw.config.values.debug==true){console.log("Has skipped the space or unused part.Data number:" + txt_num);}
 +
txt_num++;
 +
txt_next();
 
return;
 
return;
 
}
 
}
 
else if(ret == -1)
 
else if(ret == -1)
 
{
 
{
console.log("Has skipped the unused part.Data number:" + txt_now);
+
if(mw.config.values.debug==true){console.log("Has skipped the error part.Data number:" + txt_num);}
txt_now++;
+
txt_num++;
 
txt_next();
 
txt_next();
 
return;
 
return;
第232行: 第607行:
 
else if(ret == 1)
 
else if(ret == 1)
 
{
 
{
txt_now++;
+
if(mw.config.values.debug==true){console.log("Data analyze complete.Data number:" + txt_num);}
 +
txt_num++;
 
txt_next();
 
txt_next();
 
return;
 
return;
 
}
 
}
if(txt_now < txt_max && txt_now >= 0)
+
else if(ret == 2)
 
{
 
{
txt_dynamic(50);
+
if(mw.config.values.debug==true){console.log("Break and wait.Data number:" + txt_num);}
 +
txt_num++;
 +
return;
 +
}
 +
if(mw.config.values.debug==true){console.log("Data number:" + txt_num);}
 +
if(txt_num < txt_max && txt_num >= 0)
 +
{
 +
let interval = 50;
 +
if(mw.config.values.debug == true){interval = txt_interval;}
 +
now_txt_max = now_txt.length;
 +
if(timer_id.dynamic == undefined)
 +
{
 +
timer_id.dynamic = setInterval(() => {
 +
timer_dialog();
 +
},interval);
 +
}
 
}
 
}
 
}
 
}
function txt_check()
+
function txt_playback(key_cmd)
 
{
 
{
var place = 0,temp = "";
+
let temp_o1 = document.getElementById("system_playback");
if(data_txt[txt_now].indexOf(":") > 0)
+
if(key_cmd=="show")
 
{
 
{
place = data_txt[txt_now].indexOf(":");
+
if(flag_auto == true && document.getElementById("system_decision").style.display == "none"){fun_timer_clear("auto");}
document.getElementById("txt_name").innerHTML = data_txt[txt_now].substr(0,place);
+
temp_o1.style.display = "block";
txt_num = place + 1;
+
temp_o1.scrollTop = temp_o1.scrollHeight-540;
return 0;
+
document.getElementById("button_playback").style.display = "none";
 +
document.getElementById("button_playback_return").style.display = "block";
 
}
 
}
if(data_txt[txt_now].startsWith("[clear]"))
+
else if(key_cmd == "hide")
 
{
 
{
document.getElementById("pic_back").style.display = "none";
+
if (flag_auto == true && document.getElementById("system_decision").style.display == "none")
document.getElementById("pic_char_1").style.display = "none";
+
{
document.getElementById("pic_char_2").style.display = "none";
+
timer_id.auto = setInterval("timer_auto()",400);
return 1;
+
if(timer_id.txt == undefined){txt_next();}
 +
}
 +
temp_o1.style.display = "none";
 +
document.getElementById("button_playback").style.display = "block";
 +
document.getElementById("button_playback_return").style.display = "none";
 
}
 
}
else if(data_txt[txt_now].startsWith("[clear_back]"))
+
}
 +
function txt_check()
 +
{
 +
if(data_txt[txt_num].match("^\\s+$") || data_txt[txt_num].match("^\\s*//.*$")) //ONLY SPACE REGEX|COMMENT REGEX
 
{
 
{
document.getElementById("pic_back").style.display = "none";
+
return -2;
return 1;
 
 
}
 
}
else if(data_txt[txt_now].startsWith("[clear_char]"))
+
let data_command = data_txt[txt_num].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
 +
let temp = [];
 +
if (data_command == null)
 
{
 
{
document.getElementById("pic_char_1").style.display = "none";
+
temp.e1 = document.createElement("li");
document.getElementById("pic_char_2").style.display = "none";
+
now_txt = data_txt[txt_num].replace(/{@[Nn]ickname}/g,data_nickname);
return 1;
+
temp.d1 = now_txt.replace(/\<(.*?)\>/g,"")
 +
now_txt = now_txt.replace("<color=","<font color=");
 +
now_txt = now_txt.replace("</color>","</font>");
 +
if(fun_cal_len(temp.d1) > 83){temp.e1.style = "height:44px";}
 +
temp.e1.innerHTML = "<em>&nbsp;</em><span>" + now_txt + "</span>"
 +
document.getElementById("txt_name").innerHTML = ""
 +
document.getElementById("playback_result").append(temp.e1)
 +
document.getElementById("system_dialog").style.display = "block";
 +
return 0;
 
}
 
}
else if(data_txt[txt_now].startsWith("[back]"))
+
else if(decision_mode == true)
 
{
 
{
place = data_txt[txt_now].indexOf("]") + 1;
+
temp.d1 = data_command[1] == undefined ? "" : data_command[1].toLowerCase();
temp = data_txt[txt_now].substr(place);
+
temp.d2 = data_command[3] == undefined ? "" : data_command[3].toLowerCase();
document.getElementById("pic_back").innerHTML = "<img alt=\"" + temp + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[temp] + "\">";
+
if(temp.d1 != 'predicate' && temp.d2 != 'predicate'){return -2;}
document.getElementById("pic_back").style.display = "block";
 
return 1;
 
 
}
 
}
else if(data_txt[txt_now].startsWith("[char]"))
+
if (data_command[1] != undefined)
 
{
 
{
place = data_txt[txt_now].indexOf("]") + 1;
+
let command_set = [];
temp = data_txt[txt_now].substr(place);
+
data_command[2] = data_command[2].replace(/["'\$]/g,"").replace(/(fadetiem)/g,"fadetime");
document.getElementById("pic_char").innerHTML = "<img alt=\"" + temp + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[temp] + "\">";
+
for (let temp_s1 of data_command[2].split(","))
document.getElementById("pic_char_1").style.display = "block";
+
{
document.getElementById("pic_char_2").style.display = "none";
+
let [p,v] = temp_s1.split("=");
 +
if(p==""){continue;}
 +
p=p.toLowerCase().trim();
 +
if(v==undefined){continue;}
 +
command_set[p] = v.trim();
 +
}
 +
switch (data_command[1].toLowerCase())
 +
{
 +
case 'background':
 +
temp.o1 = document.getElementById("pic_back");
 +
temp.c1 = command_set.fadetime == undefined ? 0.3 : command_set.fadetime;
 +
temp.c2 = temp.o1.childElementCount;
 +
temp.d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
data_back.image = temp.d1;
 +
temp.e1 = document.createElement('div');
 +
data_back.now_obj = temp.e1;
 +
var size_x,size_y,pos_x,pos_y;
 +
fun_timer_clear("back_w",1);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.c1 > 0)
 +
{
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1"
 +
}
 +
}
 +
timer_id.back_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
break;
 +
}
 +
temp.d2 = command_set.xscale == undefined ? command_set.width == undefined ? 1 : command_set.width*1 : command_set.xscale*1;
 +
temp.d3 = command_set.yscale == undefined ? command_set.height == undefined ? 1 : command_set.height*1 : command_set.yscale*1;
 +
temp.d4 = command_set.x == undefined ? 0 : command_set.x*0.75;
 +
temp.d5 = command_set.y == undefined ? 0 : command_set.y*0.75;
 +
if(data_override_check('image',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.image[txt_page_name]["L" + temp_num];
 +
temp.d2 = temp_para.xscale == undefined ? temp.d2 : temp_para.xscale*1;
 +
temp.d3 = temp_para.yscale == undefined ? temp.d3 : temp_para.yscale*1;
 +
temp.d4 = temp_para.x == undefined ? temp.d4 : temp_para.x*0.75;
 +
temp.d5 = temp_para.y == undefined ? temp.d5 : temp_para.y*0.75;
 +
command_set.screenadapt = temp_para.screenadapt == undefined ? command_set.screenadapt : temp_para.screenadapt;
 +
}
 +
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 +
{
 +
console.warn("Image Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
data_back.ori_sx = temp.d2;data_back.ori_sy = temp.d3;
 +
data_back.ori_x = temp.d4;data_back.ori_y = temp.d5;
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
size_x = temp.i1.width*0.75;size_y = temp.i1.height*0.75;
 +
command_set.screenadapt = "coverall";
 +
if(command_set.screenadapt == "coverall")
 +
{
 +
let temp_w = size_x / 960,temp_h = size_y / 540;
 +
temp_w = Math.min(temp_w,temp_h);
 +
size_x /= temp_w;size_y /= temp_w;
 +
data_back.adapt = "coverall";
 +
}
 +
else data_back.adapt = "";
 +
pos_x = 480-size_x/2;pos_y = 270-size_y/2;
 +
temp.d5 = -temp.d5;
 +
temp.e1.style.position = "absolute";
 +
temp.e1.style.width = size_x + "px";temp.e1.style.height = size_y + "px";
 +
temp.e1.style.left = pos_x + "px";temp.e1.style.top = pos_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.transform = "matrix("+temp.d2+",0,0,"+temp.d3+","+temp.d4+","+temp.d5+")";
 +
temp.o1.appendChild(temp.e1);
 +
temp.o1.style.display = "block";
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
for(let num=0;num<temp.c2;num++)
 +
{
 +
temp.o1.childNodes[0].remove();
 +
}
 +
}, temp.c1*1000);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'backgroundtween':
 +
temp.d1 = command_set.image == undefined ? data_back.image == undefined ? "" : data_back.image : command_set.image.toLowerCase();
 +
temp.c1 = command_set.duration == undefined ? 0.3 : command_set.duration;
 +
temp.o1 = data_back.now_obj;
 +
if(temp.o1 == undefined) return -1;
 +
if(temp.c1 < 0.05)
 +
{
 +
temp.c1 = 0.05;
 +
}
 +
if(temp.d1 == "") return -1;
 +
temp.d1 = command_set.xscalefrom == undefined ? command_set.xscale == undefined ? data_back.ori_sx : command_set.xscale*1 : command_set.xscalefrom*1;
 +
temp.d2 = command_set.yscalefrom == undefined ? command_set.yscale == undefined ? data_back.ori_sy : command_set.yscale*1 : command_set.yscalefrom*1;
 +
temp.d3 = command_set.xscaleto == undefined ? command_set.xscale == undefined ? data_back.ori_sx : command_set.xscale*1 : command_set.yscaleto*1;
 +
temp.d4 = command_set.yscaleto == undefined ? command_set.yscale == undefined ? data_back.ori_sy : command_set.yscale*1 : command_set.yscaleto*1;
 +
temp.d5 = command_set.xfrom == undefined ? command_set.x == undefined ? data_back.ori_x : command_set.x*0.75 : command_set.xfrom*0.75;
 +
temp.d6 = command_set.yfrom == undefined ? command_set.y == undefined ? data_back.ori_y : command_set.y*0.75 : command_set.yfrom*0.75;
 +
temp.d7 = command_set.xto == undefined ? command_set.x == undefined ? data_back.ori_x : command_set.x*0.75 : command_set.xto*0.75;
 +
temp.d8 = command_set.yto == undefined ? command_set.y == undefined ? data_back.ori_y : command_set.y*0.75 : command_set.yto*0.75;
 +
if(data_override_check('tween',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.tween[txt_page_name]["L" + temp_num];
 +
temp.d1 = temp_para.xscalefrom == undefined ? temp_para.xscale == undefined ? temp.d1 : temp_para.xscale*1 : temp_para.xscalefrom*1;
 +
temp.d2 = temp_para.yscalefrom == undefined ? temp_para.yscale == undefined ? temp.d2 : temp_para.yscale*1 : temp_para.yscalefrom*1;
 +
temp.d3 = temp_para.xscaleto == undefined ? temp_para.xscale == undefined ? temp.d3 : temp_para.xscale*1 : temp_para.yscaleto*1;
 +
temp.d4 = temp_para.yscaleto == undefined ? temp_para.yscale == undefined ? temp.d4 : temp_para.yscale*1 : temp_para.yscaleto*1;
 +
temp.d5 = temp_para.xfrom == undefined ? temp_para.x == undefined ? temp.d5 : temp_para.x*0.75 : temp_para.xfrom*0.75;
 +
temp.d6 = temp_para.yfrom == undefined ? temp_para.y == undefined ? temp.d6 : temp_para.y*0.75 : temp_para.yfrom*0.75;
 +
temp.d7 = temp_para.xto == undefined ? temp_para.x == undefined ? temp.d7 : temp_para.x*0.75 : temp_para.xto*0.75;
 +
temp.d8 = temp_para.yto == undefined ? temp_para.y == undefined ? temp.d8 : temp_para.y*0.75 : temp_para.yto*0.75;
 +
}
 +
temp.d6 = -temp.d6;temp.d8 = -temp.d8;
 +
temp.o1.style.transform = "matrix("+temp.d1+",0,0,"+temp.d2+","+temp.d5+","+temp.d6+")";
 +
temp.o1.style.transition = temp.c1 + "s linear"
 +
setTimeout(() => {
 +
temp.o1.style.transform = "matrix("+temp.d3+",0,0,"+temp.d4+","+temp.d7+","+temp.d8+")";
 +
}, 20);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'blocker':
 +
temp.c1 = command_set.fadetime == undefined ? 0.4 : command_set.fadetime;//默认12帧过渡时间
 +
temp.d1 = command_set.a == undefined ? 1 : command_set.a*1;
 +
temp.d2 = command_set.r == undefined ? 0 : command_set.r;
 +
temp.d3 = command_set.g == undefined ? 0 : command_set.g;
 +
temp.d4 = command_set.b == undefined ? 0 : command_set.b;
 +
if(temp.d1 > 1) //闲着没事的以防万一
 +
{
 +
temp.d1 = 1;
 +
}
 +
if(temp.c1 < 0.05)
 +
{
 +
console.warn("fadetime is too short,use the minimum capacity to instead.");
 +
temp.c1 = 0.05;
 +
}
 +
blocker_new = temp.d1;
 +
temp.c2 = (blocker_new - blocker_now) / temp.c1 / 30;
 +
temp.c2 = temp.c2.toFixed(3);temp.c2*=1;
 +
document.getElementById("system_blocker").style.backgroundColor = fun_cal_rgb(temp.d2,temp.d3,temp.d4);
 +
fun_timer_clear("blocker");
 +
timer_id.blocker = setInterval(() => {
 +
timer_blocker(temp.c2);
 +
},33);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'cameraeffect':
 +
temp.d1 = command_set.effect == undefined ? "grayscale" : command_set.effect.toLowerCase();
 +
temp.d2 = command_set.amount == undefined ? 0 : command_set.amount;
 +
temp.o1 = document.getElementById("system_camera");
 +
if(temp.d2 == 0){temp.o1.style.filter = "";}
 +
switch(temp.d1)
 +
{
 +
case 'grayscale':
 +
temp.o1.style.filter = "grayscale(" + temp.d2 + ")";
 +
break;
 +
default:
 +
temp.o1.style.filter = "";
 +
}
 +
break;
 +
case 'camerashake':
 +
temp.c1 = command_set.duration == undefined ? 0.2 : command_set.duration;
 +
temp.d1 = command_set.xstrength == undefined ? 0 : command_set.xstrength * 0.6;
 +
temp.d2 = command_set.ystrength == undefined ? 0 : command_set.ystrength * 0.6;
 +
temp.d3 = command_set.randomness == undefined ? 90 : command_set.randomness;
 +
temp.d4 = command_set.stop == undefined ? "false" : command_set.stop;
 +
fun_timer_clear("shake");
 +
if(command_set.stop == "true") return 1;
 +
if(temp.c1 < 0.05)
 +
{
 +
console.warn("The duration is too short,use the minimum value to instead.");
 +
temp.c1 = 0.05;
 +
}
 +
timer_id.shake = setInterval(() => {
 +
timer_shake(temp.d1,temp.d2,temp.d3,temp.c1*20);
 +
},50);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'character':
 +
temp.o1 = document.getElementById("pic_char");
 +
temp.c1 = command_set.fadetime == undefined ? 0 : command_set.fadetime;
 +
temp.c2 = temp.o1.childElementCount;
 +
temp.d1 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
 +
temp.d2 = command_set.name2 == undefined ? "" : command_set.name2.toLowerCase();
 +
temp.d3 = command_set.block == undefined ? "false" : command_set.block;
 +
temp.d4 = command_set.focus == undefined ? "0" : command_set.focus;
 +
var pos_x,pos_y,size_x,size_y;
 +
fun_timer_clear("char_w",1);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.c1 > 0)
 +
{
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1";
 +
}
 +
}
 +
timer_id.char_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
if(temp.d3 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
}
 +
else
 +
{
 +
if(data_override_check('char',temp.d1,txt_num) == true)
 +
{
 +
temp.d1 = data_override.char[temp.d1].name;
 +
}
 +
[temp.d5,temp.d6] = fun_char_link(temp.d1);
 +
if(temp.d5 == -1){return -1;}
 +
temp.e1 = document.createElement("div");
 +
temp.e1.id = "char_1";
 +
temp.e1.className = "pic_style";
 +
temp.d1 = data_link[temp.d5].array[temp.d6].default;
 +
if(data_pic_char[temp.d1] == undefined || data_pic_char[temp.d1] == "")
 +
{
 +
console.warn("Char Data:" + temp.d1 + " is not exist,please check the data list.");
 +
}
 +
pos_x = data_link[temp.d5].pos.x * 0.75;
 +
pos_y = data_link[temp.d5].pos.y * 0.75;
 +
size_x = data_link[temp.d5].scale.x * 0.75;
 +
size_y = data_link[temp.d5].scale.y * 0.75;
 +
if (temp.d4 == -1 || temp.d4 == 2)
 +
{
 +
temp.e1.style.filter = "brightness(50%)";
 +
temp.e1.style.zIndex = -1;
 +
}
 +
pos_x = temp.d2 == "" ? 480-size_x/2+pos_x : 330-size_x/2+pos_x;
 +
pos_y = 540-size_y/2-pos_y;
 +
temp.e1.style.backgroundPosition = pos_x + "px " + pos_y + "px";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_char[temp.d1] + "')";
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
fun_animation_clear("char_1");
 +
},temp.c1*1000);
 +
}
 +
}
 +
if(temp.d2 != "")
 +
{
 +
if(data_override_check('char',temp.d2,txt_num) == true)
 +
{
 +
temp.d2 = data_override.char[temp.d2].name;
 +
}
 +
[temp.d5,temp.d6] = fun_char_link(temp.d2);
 +
if(temp.d5 == -1){return -1;}
 +
temp.e1 = document.createElement("div");
 +
temp.e1.id = "char_2";
 +
temp.e1.className = "pic_style";
 +
temp.d2 = data_link[temp.d5].array[temp.d6].default;
 +
if(data_pic_char[temp.d2] == undefined || data_pic_char[temp.d2] == "")
 +
{
 +
console.warn("Char Data:" + temp.d2 + " is not exist,please check the data list.");
 +
}
 +
pos_x = data_link[temp.d5].pos.x * 0.75;
 +
pos_y = data_link[temp.d5].pos.y * 0.75;
 +
size_x = data_link[temp.d5].scale.x * 0.75;
 +
size_y = data_link[temp.d5].scale.y * 0.75;
 +
pos_x = 630-size_x/2+pos_x;
 +
pos_y = 540-size_y/2-pos_y;
 +
if (temp.d4 == 1)
 +
{
 +
temp.e1.style.filter = "brightness(50%)";
 +
temp.e1.style.zIndex = -1;
 +
}
 +
temp.e1.style.backgroundPosition = pos_x + "px " + pos_y + "px";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_char[temp.d2] + "')";
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
fun_animation_clear("char_2");
 +
},temp.c1*1000);
 +
}
 +
}
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
temp.o1.childNodes[0].remove();
 +
}
 +
if(temp.d3 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'charactercutin':
 +
temp.o1 = document.getElementById("pic_cutin");
 +
if(command_set.widgetid == undefined)
 +
{
 +
temp.o1.innerHTML = "";
 +
return -1;
 +
}
 +
temp.c1 = command_set.fadetime == undefined ? 0.28 : command_set.fadetime;
 +
temp.d1 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
 +
temp.d2 = "cutin_" + command_set.widgetid;
 +
temp.d4 = command_set.offsetx == undefined ? 480 : 480+command_set.offsetx*0.75;
 +
temp.d5 = command_set.width == undefined ? 150 : command_set.width*0.75;
 +
temp.d6 = command_set.height == undefined ? 540 : command_set.height*0.75;
 +
temp.d10 = command_set.block == undefined ? "false" : command_set.block;
 +
var size_x,size_y;
 +
temp.o2 = document.getElementById(temp.d2);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.o2 == undefined){return -1;}
 +
data_cutin[temp.d2].times = temp.c1 < 0.02 ? 1 : temp.c1*50;
 +
data_cutin[temp.d2].state = "hide";
 +
if(data_cutin[temp.d2].style == 0)
 +
{
 +
temp.o2.style.animation = "fade-out " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.o2.remove();
 +
},temp.c1);
 +
}
 +
else
 +
{
 +
timer_id.cutin = setInterval(() => {
 +
timer_cutin(temp.d2);
 +
}, 20);
 +
}
 +
if(temp.d10 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
}
 +
data_cutin[temp.d2] = [];
 +
data_cutin[temp.d2].state = "show";
 +
data_cutin[temp.d2].times = temp.c1 < 0.02 ? 1 : temp.c1*50;
 +
data_cutin[temp.d2].width = temp.d5;
 +
data_cutin[temp.d2].height = temp.d6;
 +
data_cutin[temp.d2].offsetx = temp.d4;
 +
if(temp.o2 == undefined)
 +
{
 +
temp.o2 = document.createElement('div');
 +
temp.o2.id = temp.d2;
 +
temp.o2.className = "cutin_style";
 +
temp.o1.append(temp.o2);
 +
}
 +
switch(command_set.fadestyle)
 +
{
 +
case 'horiz_expand_center':
 +
data_cutin[temp.d2].style = 1;
 +
temp.d7 = temp.d4;
 +
temp.d8 = 0;
 +
break;
 +
case 'horiz_expand_left2right':
 +
data_cutin[temp.d2].style = 2;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = 0;
 +
break;
 +
case 'horiz_expand_right2left':
 +
data_cutin[temp.d2].style = 3;
 +
temp.d7 = temp.d4+temp.d5/2;
 +
temp.d8 = 0;
 +
case 'vert_expand_center':
 +
data_cutin[temp.d2].style = 4;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = temp.d6/2;
 +
break;
 +
case 'vert_expand_top2buttom':
 +
data_cutin[temp.d2].style = 5;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = 0;
 +
break;
 +
case 'vert_expand_buttom2top':
 +
data_cutin[temp.d2].style = 6;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = temp.d6;
 +
break;
 +
default:
 +
data_cutin[temp.d2].style = 0;
 +
temp.d7 = temp.d5-temp.d5/2;
 +
temp.d8 = 0;
 +
}
 +
//data_cutin[temp.d2].left = temp.d7;data_cutin[temp.d2].top = temp.d8;
 +
temp.o2.style.left = temp.d7 + "px";
 +
temp.o2.style.top = temp.d8 + "px";
 +
[temp.d7,temp.d8] = fun_char_link(temp.d1);
 +
if(temp.d7 == -1){return -1;}
 +
size_x = data_link[temp.d7].scale.x * 0.75;
 +
size_y = data_link[temp.d7].scale.y * 0.75;
 +
temp.d1 = data_link[temp.d7].array[temp.d8].default;
 +
if(data_pic_char[temp.d1] == undefined || data_pic_char[temp.d1] == "")
 +
{
 +
console.warn("Char Data:" + temp.d1 + " is not exist,please check the data list.");
 +
}
 +
temp.o2.style.backgroundSize =  size_x + "px " + size_y + "px";
 +
temp.o2.style.backgroundImage = "url('" + data_pic_char[temp.d1] + "')";
 +
if(data_cutin[temp.d2].style > 0 && data_cutin[temp.d2].style <= 3)
 +
{
 +
temp.o2.style.width = "0px";
 +
temp.o2.style.height = temp.d6 + "px";
 +
}
 +
else if(data_cutin[temp.d2].style > 3 && data_cutin[temp.d2].style <=6)
 +
{
 +
temp.o2.style.width = temp.d5 + "px";
 +
temp.o2.style.height = "0px";
 +
}
 +
if(data_cutin[temp.d2].style == 0)
 +
{
 +
temp.o2.style.width = temp.d5 + "px";
 +
temp.o2.style.height = temp.d6 + "px";
 +
temp.o2.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.o2.style.animation = "";
 +
},temp.c1);
 +
}
 +
else
 +
{
 +
timer_id.cutin = setInterval(() => {
 +
timer_cutin(temp.d2);
 +
}, 20);
 +
}
 +
if(temp.d10 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'delay':
 +
if (command_set.time == undefined){return -1;}
 +
fun_delay("block",command_set.time);
 +
return 2;
 +
case 'decision':
 +
if(command_set.options == undefined){return -1;}
 +
temp.d1 = command_set.options.split(";");
 +
temp.c1 = command_set.values.split(";");
 +
for (let num=1;num<4;num++)
 +
{
 +
temp["o"+num] = document.getElementById("decision_" + num);
 +
temp["o"+num].style.top = 72*(num+1) + "px"
 +
temp["o"+num].style.fontSize = "";
 +
}
 +
switch (temp.d1.length)
 +
{
 +
case 1:
 +
decision_value = [-1,temp.c1[0],-1];
 +
temp.o1.innerHTML = "&nbsp;"
 +
temp.o1.style.display = "none";
 +
temp.o2.innerHTML = temp.d1[0];
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o2.style.fontSize = "10px";
 +
}
 +
temp.o2.style.display = "block";
 +
temp.o3.innerHTML = "&nbsp;"
 +
temp.o3.style.display = "none";
 +
break;
 +
case 2:
 +
decision_value = [temp.c1[0],-1,temp.c1[1]];
 +
temp.o1.innerHTML = temp.d1[0];
 +
temp.o1.style.top = "180px";
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o1.style.fontSize = "10px";
 +
}
 +
temp.o1.style.display = "block";
 +
temp.o2.innerHTML = "&nbsp;"
 +
temp.o2.style.display = "none";
 +
temp.o3.innerHTML = temp.d1[1];
 +
temp.o3.style.top = "252px";
 +
if(fun_cal_len(temp.d1[1]) > 32)
 +
{
 +
temp.o3.style.fontSize = "10px";
 +
}
 +
temp.o3.style.display = "block";
 +
break;
 +
case 3:
 +
decision_value = [temp.c1[0],temp.c1[1],temp.c1[2]];
 +
temp.o1.innerHTML = temp.d1[0];
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o1.style.fontSize = "10px";
 +
}
 +
temp.o1.style.display = "block";
 +
temp.o2.innerHTML = temp.d1[1];
 +
if(fun_cal_len(temp.d1[1]) > 32)
 +
{
 +
temp.o2.style.fontSize = "10px";
 +
}
 +
temp.o2.style.display = "block";
 +
temp.o3.innerHTML = temp.d1[2];
 +
if(fun_cal_len(temp.d1[2]) > 32)
 +
{
 +
temp.o3.style.fontSize = "10px";
 +
}
 +
temp.o3.style.display = "block";
 +
break;
 +
default:
 +
console.error("decision data error.");
 +
return -1;
 +
}
 +
if(flag_auto == true)
 +
{
 +
fun_timer_clear("auto");
 +
}
 +
fun_setting("cmd_close");
 +
document.getElementById("system_decision").style.display = "block";
 +
return 2;
 +
case 'header':
 +
return -1;
 +
case 'hideitem':
 +
temp.o1 = document.getElementById("pic_item").lastElementChild;
 +
temp.d1 = command_set.block == undefined ? "true" : command_set.block;
 +
temp.c1 = command_set.fadetime == undefined ? 0.32 : command_set.fadetime;
 +
if(temp.o1 == undefined){return -1;}
 +
temp.o1.style.animation = "fade-out " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
temp.o1.remove();
 +
}, temp.c1*950);
 +
if(temp.d1 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'image':
 +
temp.o1 = document.getElementById("pic_image");
 +
temp.c1 = command_set.fadetime == undefined ? 0.3 : command_set.fadetime;
 +
temp.c2 = temp.o1.childElementCount;
 +
temp.d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
data_image.image = temp.d1;
 +
temp.e1 = document.createElement('div');
 +
data_image.now_obj = temp.e1;
 +
var size_x,size_y,pos_x,pos_y;
 +
fun_timer_clear("image_w",1);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.c1 > 0)
 +
{
 +
for(let num=0;num<temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1"
 +
}
 +
}
 +
timer_id.image_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
break;
 +
}
 +
temp.d2 = command_set.xscale == undefined ? command_set.width == undefined ? 1 : command_set.width*1 : command_set.xscale*1;
 +
temp.d3 = command_set.yscale == undefined ? command_set.height == undefined ? 1 : command_set.height*1 : command_set.yscale*1;
 +
temp.d4 = command_set.x == undefined ? 0 : command_set.x*0.75;
 +
temp.d5 = command_set.y == undefined ? 0 : command_set.y*0.75;
 +
if(data_override_check('image',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.image[txt_page_name]["L" + temp_num];
 +
temp.d2 = temp_para.xscale == undefined ? temp.d2 : temp_para.xscale*1;
 +
temp.d3 = temp_para.yscale == undefined ? temp.d3 : temp_para.yscale*1;
 +
temp.d4 = temp_para.x == undefined ? temp.d4 : temp_para.x*0.75;
 +
temp.d5 = temp_para.y == undefined ? temp.d5 : temp_para.y*0.75;
 +
command_set.screenadapt = temp_para.screenadapt == undefined ? command_set.screenadapt : temp_para.screenadapt;
 +
}
 +
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 +
{
 +
console.warn("Image Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
data_image.ori_sx = temp.d2;data_image.ori_sy = temp.d3;
 +
data_image.ori_x = temp.d4;data_image.ori_y = temp.d5;
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
size_x = temp.i1.width*0.75;size_y = temp.i1.height*0.75;
 +
if(command_set.screenadapt == "coverall")
 +
{
 +
let temp_w = size_x / 960,temp_h = size_y / 540;
 +
temp_w = Math.min(temp_w,temp_h);
 +
size_x /= temp_w;size_y /= temp_w;
 +
data_image.adapt = "coverall";
 +
}
 +
else data_image.adapt = "";
 +
pos_x = 480-size_x/2;pos_y = 270-size_y/2;
 +
temp.d5 = -temp.d5;
 +
temp.e1.style.position = "absolute";
 +
temp.e1.style.width = size_x + "px";temp.e1.style.height = size_y + "px";
 +
temp.e1.style.left = pos_x + "px";temp.e1.style.top = pos_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.transform = "matrix("+temp.d2+",0,0,"+temp.d3+","+temp.d4+","+temp.d5+")";
 +
temp.o1.appendChild(temp.e1);
 +
temp.o1.style.display = "block";
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
for(let num=0;num<temp.c2;num++)
 +
{
 +
temp.o1.childNodes[0].remove();
 +
}
 +
}, temp.c1*1000);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'imagetween':
 +
temp.d1 = command_set.image == undefined ? data_image.image == undefined ? "" : data_image.image : command_set.image.toLowerCase();
 +
temp.c1 = command_set.duration == undefined ? 0.3 : command_set.duration;
 +
temp.o1 = data_image.now_obj;
 +
if(temp.o1 == undefined) return -1;
 +
fun_timer_clear("image");
 +
if(temp.c1 < 0.05)
 +
{
 +
temp.c1 = 0.05;
 +
}
 +
if(temp.d1 == "") return -1;
 +
temp.d1 = command_set.xscalefrom == undefined ? command_set.xscale == undefined ? data_image.ori_sx : command_set.xscale*1 : command_set.xscalefrom*1;
 +
temp.d2 = command_set.yscalefrom == undefined ? command_set.yscale == undefined ? data_image.ori_sy : command_set.yscale*1 : command_set.yscalefrom*1;
 +
temp.d3 = command_set.xscaleto == undefined ? command_set.xscale == undefined ? data_image.ori_sx : command_set.xscale*1 : command_set.yscaleto*1;
 +
temp.d4 = command_set.yscaleto == undefined ? command_set.yscale == undefined ? data_image.ori_sy : command_set.yscale*1 : command_set.yscaleto*1;
 +
temp.d5 = command_set.xfrom == undefined ? command_set.x == undefined ? data_image.ori_x : command_set.x*0.75 : command_set.xfrom*0.75;
 +
temp.d6 = command_set.yfrom == undefined ? command_set.y == undefined ? data_image.ori_y : command_set.y*0.75 : command_set.yfrom*0.75;
 +
temp.d7 = command_set.xto == undefined ? command_set.x == undefined ? data_image.ori_x : command_set.x*0.75 : command_set.xto*0.75;
 +
temp.d8 = command_set.yto == undefined ? command_set.y == undefined ? data_image.ori_y : command_set.y*0.75 : command_set.yto*0.75;
 +
if(data_override_check('tween',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.tween[txt_page_name]["L" + temp_num];
 +
temp.d1 = temp_para.xscalefrom == undefined ? temp_para.xscale == undefined ? temp.d1 : temp_para.xscale*1 : temp_para.xscalefrom*1;
 +
temp.d2 = temp_para.yscalefrom == undefined ? temp_para.yscale == undefined ? temp.d2 : temp_para.yscale*1 : temp_para.yscalefrom*1;
 +
temp.d3 = temp_para.xscaleto == undefined ? temp_para.xscale == undefined ? temp.d3 : temp_para.xscale*1 : temp_para.yscaleto*1;
 +
temp.d4 = temp_para.yscaleto == undefined ? temp_para.yscale == undefined ? temp.d4 : temp_para.yscale*1 : temp_para.yscaleto*1;
 +
temp.d5 = temp_para.xfrom == undefined ? temp_para.x == undefined ? temp.d5 : temp_para.x*0.75 : temp_para.xfrom*0.75;
 +
temp.d6 = temp_para.yfrom == undefined ? temp_para.y == undefined ? temp.d6 : temp_para.y*0.75 : temp_para.yfrom*0.75;
 +
temp.d7 = temp_para.xto == undefined ? temp_para.x == undefined ? temp.d7 : temp_para.x*0.75 : temp_para.xto*0.75;
 +
temp.d8 = temp_para.yto == undefined ? temp_para.y == undefined ? temp.d8 : temp_para.y*0.75 : temp_para.yto*0.75;
 +
}
 +
temp.d6 = -temp.d6;temp.d8 = -temp.d8;
 +
temp.o1.style.transform = "matrix("+temp.d1+",0,0,"+temp.d2+","+temp.d5+","+temp.d6+")";
 +
temp.o1.style.transition = temp.c1 + "s linear"
 +
setTimeout(() => {
 +
temp.o1.style.transform = "matrix("+temp.d3+",0,0,"+temp.d4+","+temp.d7+","+temp.d8+")";
 +
}, 20);
 +
console.log("transform from:xscale=" + temp.d1 + ",yscale=" + temp.d2 + ",x=" + temp.d5 + ",y=" + temp.d6);
 +
console.log("transform to:xscale=" + temp.d3 + ",yscale=" + temp.d4 + ",x=" + temp.d7 + ",y=" + temp.d8);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'playmusic':
 +
temp.o1 = document.getElementById("system_music");
 +
temp.c1 = command_set.delay == undefined ? 0 : command_set.delay * 1000;
 +
temp.d1 = command_set.intro == undefined ? "" : command_set.intro.toLowerCase();
 +
temp.d2 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
fun_timer_clear("music");
 +
temp.o1.volume = command_set.volume == undefined ? 0.4 : Math.min(command_set.volume*0.5,1);
 +
if(temp.d1 == "")
 +
{
 +
console.warn("Music intro is not exist.");
 +
if(temp.d2 != "" && data_audio[temp.d2] != undefined)
 +
{
 +
temp.o1.src = data_audio[temp.d2];
 +
temp.o1.loop = true;
 +
setTimeout(() => {
 +
temp.o1.play();
 +
},temp.c1);
 +
break;
 +
}
 +
return -1;
 +
}
 +
else if(data_audio[temp.d1] == undefined)
 +
{
 +
console.warn("Audio Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
temp.o1.src = data_audio[temp.d1];
 +
if(temp.d2 == "")
 +
{
 +
console.warn("Music key is no exist,has use the intro to instead.");
 +
music_loop = data_audio[temp.d1];
 +
}
 +
else
 +
{
 +
music_loop = data_audio[temp.d2];
 +
}
 +
temp.o1.loop = false;
 +
setTimeout(() => {
 +
temp.o1.play();
 +
temp.o1.onended = () => {
 +
temp.o1.src = music_loop;
 +
temp.o1.loop = true;
 +
temp.o1.play();
 +
};
 +
},temp.c1);
 +
break;
 +
case 'playsound':
 +
temp.o1 = new Audio();
 +
temp.c1 = command_set.delay == undefined ? 0 : command_set.delay * 1000;
 +
temp.d1 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
if(temp.d1 == "")
 +
{
 +
console.error("Command Analyze error:Audio is not exist.");
 +
return -1;
 +
}
 +
else if(data_audio[temp.d1] == undefined)
 +
{
 +
console.warn("Audio Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
temp.o1.volume = command_set.volume == undefined ? 0.5 : Math.min(command_set.volume*0.5,1);
 +
temp.o1.src = data_audio[temp.d1];
 +
document.getElementById("system_audio").appendChild(temp.o1);
 +
setTimeout(() => {
 +
temp.o1.play();
 +
temp.o1.onended = () => {
 +
document.getElementById("system_audio").removeChild(temp.o1);
 +
};
 +
}, temp.c1);
 +
break;
 +
case 'predicate':
 +
if (command_set.references == undefined)
 +
{
 +
decision_mode = false;
 +
break;
 +
}
 +
if (command_set.references.includes(decision_select) == true)
 +
{
 +
decision_mode = false;
 +
break;
 +
}
 +
decision_mode = true;
 +
break;
 +
case 'showitem':
 +
temp.o1 = document.getElementById("pic_item");
 +
temp.d1 = command_set.image == undefined ? "" : command_set.image;
 +
temp.d2 = command_set.block == undefined ? "true" : command_set.block;
 +
temp.c1 = command_set.fadetime == undefined ? 0.32 : command_set.fadetime*1;
 +
if(temp.d1 == ""){return -1;}
 +
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 +
{
 +
console.warn("Item data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
temp.c2 = temp.i1.width*0.6;temp.c3 = temp.i1.height*0.6;
 +
temp.c4 = (960-temp.c2)/2-7.5;temp.c5 = (540-temp.c3)/2-7.5;
 +
temp.e1 = document.createElement('div');
 +
temp.e1.className = "item_style";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = "100% 100%";
 +
temp.e1.style.width = temp.c2 + "px";temp.e1.style.height = temp.c3 + "px";
 +
temp.e1.style.left = temp.c4 + "px";temp.e1.style.top = temp.c5 + "px";
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
},temp.c1*1000);
 +
}
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.d2 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'stopmusic':
 +
temp.d1 = command_set.fadetime == undefined ? 6 : command_set.fadetime * 30;
 +
temp.c1 = document.getElementById("system_music").volume;
 +
if(temp.d1 > 0)
 +
{
 +
temp.c1 /= temp.d1;
 +
timer_id.music = setInterval(() => {
 +
let temp_c1 = document.getElementById("system_music").volume;
 +
temp_c1 -= temp.c1;
 +
if(temp_c1 <= 0)
 +
{
 +
temp_c1 = 0;
 +
fun_timer_clear("music");
 +
audio_stop("music");
 +
}
 +
document.getElementById("system_music").volume = temp_c1;
 +
}, 33);
 +
}
 +
else
 +
{
 +
audio_stop("music");
 +
}
 +
return 1;
 +
default:
 +
return -1;
 +
}
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[char_"))
+
else if(data_command[3] != undefined)
 
{
 
{
var pic_left = "",pic_right = "";
+
switch(data_command[3].toLowerCase())
var char_left = document.getElementById("pic_char_left");
 
var char_right = document.getElementById("pic_char_right");
 
place = data_txt[txt_now].indexOf("]") + 1;
 
temp = data_txt[txt_now].substr(place);
 
temp = temp.split(",");
 
if(temp.length <= 1)
 
 
{
 
{
console.error("Command analyze failed.");
+
case 'background':
return -1;
+
temp.o1 = document.getElementById("pic_back");
 +
fun_timer_clear("back");
 +
temp.o1.innerHTML = "";
 +
break;
 +
case 'character':
 +
temp.o1 = document.getElementById("pic_char");
 +
temp.o1.innerHTML = "";
 +
break;
 +
case 'dialog':
 +
document.getElementById("txt_name").innerHTML = "";
 +
document.getElementById("txt_output").innerHTML = "";
 +
document.getElementById("system_dialog").style.display = "none";
 +
break;
 +
case 'image':
 +
temp.o1 = document.getElementById("pic_image");
 +
fun_timer_clear("image");
 +
temp.o1.innerHTML = "";
 +
break;
 +
case 'predicate':
 +
decision_mode = false;
 +
break;
 +
case 'hideitem':
 +
temp.o1 = document.getElementById("pic_item").lastElementChild;
 +
if(temp.o1 == undefined){return -1;}
 +
temp.o1.style.animation = "fade-out 0.32s 1";
 +
setTimeout(() => {
 +
temp.o1.remove();
 +
}, 304);
 +
fun_delay("block",0.32);
 +
return 2;
 
}
 
}
pic_left=temp[0];
+
return 1;
pic_right=temp[1];
+
}
char_left.innerHTML = "<img alt=\"" + pic_left + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[pic_left] + "\">";
+
else if(data_command[4] != undefined)
char_right.innerHTML = "<img alt=\"" + pic_right + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[pic_right] + "\">";
+
{
if (data_txt[txt_now].startsWith("[char_left]"))
+
temp.d1 = data_command[4].toLowerCase();
{
+
if(temp.d1.search("delay") == 0)
char_left.style.display = "block";
 
char_right.style.display = "none";
 
}
 
else if (data_txt[txt_now].startsWith("[char_right]"))
 
 
{
 
{
char_right.style.display = "block";
+
temp.c1 = temp.d1.lastIndexOf("=")
char_left.style.display = "none";
+
temp.c1 = temp.d1.substr(temp.c1+1)
 +
fun_delay("block",temp.c1);
 +
return 2;
 
}
 
}
else if (data_txt[txt_now].startsWith("[char_both]"))
+
temp.e1 = document.createElement("li");
 +
temp.d1 = data_command[4].replace(/(^[^"]+)"([^"]*)"/,"$2");
 +
now_txt = data_command[5].replace(/{@[Nn]ickname}/g,data_nickname);
 +
temp.d2 = now_txt.replace(/\<(.*?)\>/g,"")
 +
now_txt = now_txt.replace("<color=","<font color=");
 +
now_txt = now_txt.replace("</color>","</font>");
 +
if(fun_cal_len(temp.d1) > 12 || fun_cal_len(temp.d2) > 83)
 
{
 
{
char_left.style.display = "block";
+
temp.e1.style = "height:44px";
char_right.style.display = "block";
 
 
}
 
}
document.getElementById("pic_char_1").style.display = "block";
+
if(temp.d1 == ""){temp.d1 = "&nbsp;"}
document.getElementById("pic_char_2").style.display = "block";
+
temp.e1.innerHTML = "<em>" + temp.d1 + "</em><span>" + now_txt + "</span>"
return 1;
+
document.getElementById("txt_name").innerHTML = temp.d1
 +
document.getElementById("playback_result").append(temp.e1)
 +
document.getElementById("system_dialog").style.display = "block";
 
}
 
}
 
return 0;
 
return 0;
第326行: 第1,606行:
 
function txt_auto()
 
function txt_auto()
 
{
 
{
if(auto_enabled == false)
+
if(reset_enabled == false)
 
{
 
{
return;
+
reset_enabled = true;
 +
document.getElementById("button_reset").style.color = "";
 
}
 
}
reset_enabled = true;
 
document.getElementById("button_reset").style.color = "";
 
 
if(flag_auto == false)
 
if(flag_auto == false)
 
{
 
{
if (system_enabled == true)
+
flag_auto = true;
 +
if(txt_num == 0)
 +
{
 +
fun_setting("pre");
 +
}
 +
fun_timer_clear("auto");
 +
auto_num = 1;
 +
timer_id.auto = setInterval(() => {
 +
timer_auto();
 +
},400);
 +
if(click_enabled == true && timer_id.dynamic == undefined && timer_id.txt == undefined)
 
{
 
{
system_enabled = false;
+
txt_next();
 
}
 
}
auto_num = 1;
 
timer_id_auto = setInterval("auto_dynamic()",400);
 
flag_auto = true;
 
timer_id_wait = setTimeout("txt_next()",txt_num_max*80+Math.min(txt_num_max,1)*1000);
 
 
}
 
}
 
else if(flag_auto == true)
 
else if(flag_auto == true)
第347行: 第1,632行:
 
auto_stop();
 
auto_stop();
 
}
 
}
 +
}
 +
function auto_stop()
 +
{
 +
fun_timer_clear("auto");
 +
document.getElementById("button_auto").innerHTML = "自动▶";
 +
flag_auto = false;
 
}
 
}
 
function txt_reset()
 
function txt_reset()
第352行: 第1,643行:
 
if(reset_enabled == false)
 
if(reset_enabled == false)
 
{
 
{
system_enabled = true;
+
if(mw.config.values.debug==true){console.log("reset didn't passed.");}
// console.log("reset didn't passed.");
 
 
return;
 
return;
 
}
 
}
system_enabled = false;
+
if(mw.config.values.debug==true){console.log("reset passed.");}
// console.log("reset passed.");
 
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
 
auto_stop();
 
auto_stop();
 
}
 
}
if(flag_timer == true)
+
if(timer_id.dynamic != undefined)
 
{
 
{
 
txt_stop();
 
txt_stop();
 
}
 
}
document.getElementById("pic_back").style.display = "none";
+
fun_setting("reset");
document.getElementById("pic_char_1").style.display = "none";
 
document.getElementById("pic_char_2").style.display = "none";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
 
document.getElementById("txt_output").innerHTML = "剧情模拟已重置,单击开始剧情回顾";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已重置,单击开始剧情回顾";
reset_enabled = false;
 
document.getElementById("button_reset").style.color = "#808080"
 
txt_now = 0;
 
txt_num_max = 0;
 
 
return;
 
return;
 
}
 
}
function auto_stop()
+
function txt_stop(stop_type)
 
{
 
{
clearInterval(timer_id_auto);
+
let temp_c1=100,temp_c2=1200;
document.getElementById("button_auto").innerHTML = "自动▶";
+
if(mw.config.values.debug==true)
if(flag_timer == false && flag_auto == true)
 
 
{
 
{
clearTimeout(timer_id_wait);
+
if(stop_type == "n")
 +
{
 +
console.log("The timer has been stop naturally.");
 +
}
 +
else if(stop_type == "f")
 +
{
 +
console.log("The timer has been forced stop.");
 +
}
 +
temp_c1 = txt_delay_per;temp_c2 = txt_delay_all;
 
}
 
}
flag_auto = false;
+
fun_timer_clear("txt",1);
 +
timer_id.txt = setTimeout(() => {
 +
if(timer_id.auto != undefined)
 +
{
 +
txt_next();
 +
}
 +
fun_timer_clear("txt",1);
 +
},now_txt_max*temp_c1+temp_c2);
 +
fun_timer_clear("dynamic");
 +
now_txt_num = 0;
 +
now_txt_temp = "";
 +
txt_num++;
 
}
 
}
function txt_stop()
+
function txt_decision(choice)
 
{
 
{
clearInterval(timer_id);
+
let temp_e1 = document.createElement('li');
flag_timer = false;
+
let temp_a1 = [];
txt_num = 0;
+
temp_e1.style = "height:66px";
txt_temp = "";
+
for (let num=1;num<4;num++)
txt_now++;
+
{
 +
if(num==choice+1)
 +
{
 +
temp_a1[num] = "<span style='color:skyblue'>" + document.getElementById("decision_" + num).innerHTML + "</span>";
 +
}
 +
else
 +
{
 +
temp_a1[num] = "<span>" + document.getElementById("decision_" + num).innerHTML + "</span>";
 +
}
 +
}
 +
temp_e1.innerHTML = "<em style='height:70px;'>&nbsp;</em>" + temp_a1[1] + temp_a1[2] + temp_a1[3];
 +
document.getElementById("playback_result").append(temp_e1);
 +
let temp_audio = new Audio();
 +
temp_audio.src = "//ak.mooncell.wiki/images/1/1a/G_ui_btn_n.mp3";
 +
document.getElementById("system_audio").appendChild(temp_audio);
 +
temp_audio.onended = () => {document.getElementById("system_audio").removeChild(temp_audio)};
 +
temp_audio.play();
 +
decision_select = decision_value[choice];
 +
fun_setting("cmd_open");
 +
document.getElementById("system_decision").style.display = "none";
 +
if(flag_auto == true && timer_id.auto == undefined)
 +
{
 +
timer_id.auto = setInterval("timer_auto()",400);
 +
}
 +
txt_next();
 
}
 
}
function auto_dynamic()
+
function audio_stop(key_cmd)
 
{
 
{
var button_auto = document.getElementById("button_auto");
+
if(key_cmd == "all" || key_cmd == "music")
 +
{
 +
let obj_temp = document.getElementById("system_music");
 +
obj_temp.onended = "";
 +
obj_temp.pause();
 +
obj_temp.currentTime = 0;
 +
obj_temp.loop = false;
 +
obj_temp.src = "";
 +
}
 +
if(key_cmd == "all" || key_cmd == "sound")
 +
{
 +
document.getElementById("system_audio").innerHTML = "";
 +
}
 +
}
 +
function timer_auto()
 +
{
 +
let temp_obj = document.getElementById("button_auto");
 
switch (auto_num)
 
switch (auto_num)
 
{
 
{
 
case 1:
 
case 1:
button_auto.innerHTML = "自动▶";
+
temp_obj.innerHTML = "自动▶";
 
break;
 
break;
 
case 2:
 
case 2:
button_auto.innerHTML = "自动▶▶";
+
temp_obj.innerHTML = "自动▶▶";
 
break;
 
break;
 
case 3:
 
case 3:
button_auto.innerHTML = "自动▶▶▶";
+
temp_obj.innerHTML = "自动▶▶▶";
 
auto_num=0;
 
auto_num=0;
 
break;
 
break;
第413行: 第1,753行:
 
auto_num++;
 
auto_num++;
 
}
 
}
function txt_dynamic(interval)
+
function timer_blocker(temp_d1)
 
{
 
{
if (debug == true)
+
blocker_now += temp_d1;
 +
let temp_obj = document.getElementById("system_blocker");
 +
let temp_c1 = blocker_new-blocker_now;
 +
if((temp_d1>0 && temp_c1>0)||(temp_d1<0 && temp_c1<0))
 
{
 
{
txt_num_max = now_txt.length;
+
temp_obj.style.opacity = blocker_now;
 +
return 0;
 +
}
 +
blocker_now = blocker_new;
 +
fun_timer_clear("blocker");
 +
temp_obj.style.opacity = blocker_now;
 +
}
 +
function timer_cutin(temp_d1)
 +
{
 +
let temp = [];
 +
temp.o1 = document.getElementById(temp_d1);
 +
if(data_cutin[temp_d1].style > 0 && data_cutin[temp_d1].style <= 3)
 +
{
 +
temp.d1 = temp.o1.style.width;temp.d2=temp.o1.style.left;
 +
temp.d1 = temp.d1.substr(0,temp.d1.indexOf("px"));temp.d1*=1;
 +
temp.d2 = temp.d2.substr(0,temp.d2.indexOf("px"));temp.d2*=1;
 +
temp.c1 = data_cutin[temp_d1].width/data_cutin[temp_d1].times;
 +
switch(data_cutin[temp_d1].style)
 +
{
 +
case 1:
 +
temp.c2 = -temp.c1/2;
 +
break;
 +
case 2:
 +
temp.c2 = 0;
 +
break;
 +
case 3:
 +
temp.c2 = temp.c1;
 +
break;
 +
}
 +
if(mw.config.values.debug) console.log("width="+temp.d1+",left="+temp.d2+",change_width="+temp.c1+",change_left="+temp.c2);
 +
if(data_cutin[temp_d1].state == "show")
 +
{
 +
temp.d1 += temp.c1;
 +
temp.d2 += temp.c2;
 +
if(temp.d1 >= data_cutin[temp_d1].width)
 +
{
 +
fun_timer_clear("cutin");
 +
temp.d1 = data_cutin[temp_d1].width;
 +
temp.d2 = data_cutin[temp_d1].offsetx-temp.d1/2;
 +
}
 +
}
 +
else if(data_cutin[temp_d1].state == "hide")
 +
{
 +
temp.d1 -= temp.c1;
 +
temp.d2 -= temp.c2;
 +
if(temp.d1 <= 0)
 +
{
 +
fun_timer_clear("cutin");
 +
temp.o1.remove();
 +
return;
 +
}
 +
}
 +
temp.o1.style.width = temp.d1 + "px";
 +
temp.o1.style.left = temp.d2 + "px";
 +
}
 +
else if(data_cutin[temp_d1].style > 3 && data_cutin[temp_d1].style <= 6)
 +
{
 +
temp.d1 = temp.o1.style.height;temp.d2=temp.o1.style.top;
 +
temp.d1 = temp.d1.substr(0,temp.d1.indexOf("px"));temp.d1*=1;
 +
temp.d2 = temp.d2.substr(0,temp.d2.indexOf("px"));temp.d2*=1;
 +
temp.c1 = data_cutin[temp_d1].height/data_cutin[temp_d1].times;
 +
switch(data_cutin[temp_d1].style)
 +
{
 +
case 4:
 +
temp.c2 = -temp.c1/2;
 +
break;
 +
case 5:
 +
temp.c2 = 0;
 +
break;
 +
case 6:
 +
temp.c2 = temp.c1;
 +
break;
 +
}
 +
if(mw.config.values.debug) console.log("height="+temp.d1+",top="+temp.d2+",change_height="+temp.c1+",change_top="+temp.c2);
 +
if(data_cutin[temp_d1].state == "show")
 +
{
 +
temp.d1 += temp.c1;
 +
temp.d2 += temp.c2;
 +
if(temp.d1 >= data_cutin[temp_d1].height)
 +
{
 +
fun_timer_clear("cutin");
 +
temp.d1 = data_cutin[temp_d1].height;
 +
temp.d2 = 0;
 +
}
 +
}
 +
else if(data_cutin[temp_d1].state == "hide")
 +
{
 +
temp.d1 -= temp.c1;
 +
temp.d2 -= temp.c2;
 +
if(temp.d1 <= 0)
 +
{
 +
fun_timer_clear("cutin");
 +
temp.o1.remove();
 +
return;
 +
}
 +
}
 +
temp.o1.style.height = temp.d1 + "px";
 +
temp.o1.style.top = temp.d2 + "px";
 
}
 
}
 
else
 
else
 
{
 
{
txt_num_max = data_txt[txt_now].length;
+
fun_timer_clear("cutin");
 +
return;
 
}
 
}
flag_timer = true;
 
timer_id = setInterval("timer1()",50);
 
 
}
 
}
function timer1()
+
function timer_dialog()
 
{
 
{
if (txt_num < txt_num_max)
+
let temp_c1;
 +
if (now_txt_num < now_txt_max)
 
{
 
{
if (debug == true)
+
if(now_txt.substr(now_txt_num,1) == "<")
 
{
 
{
txt_temp = txt_temp + now_txt[txt_now].substr(txt_num,1);
+
for(temp_c1 = now_txt_num + 1;temp_c1 < now_txt_max;temp_c1++)
 +
{
 +
if(now_txt.substr(temp_c1,1) == ">")
 +
{
 +
break;
 +
}
 +
}
 +
now_txt_temp = now_txt_temp + now_txt.substr(now_txt_num,temp_c1 - now_txt_num + 1);
 +
now_txt_num = temp_c1 + 1;
 
}
 
}
else
+
now_txt_temp = now_txt_temp + now_txt.substr(now_txt_num,1);
 +
document.getElementById("txt_output").innerHTML = now_txt_temp;
 +
now_txt_num++;
 +
return;
 +
}
 +
txt_stop("n");
 +
}
 +
function timer_shake(str_x,str_y,ran_n,max_t)
 +
{
 +
let temp_obj = document.getElementById("system_main");
 +
let temp_c1 = parseInt(Math.random()*99) + 1;
 +
let str_x2 = str_y == 0 ? str_x : str_x * 0.707,str_y2 = str_x == 0 ? str_y : str_y * 0.707;
 +
let temp_a1 = [0,-str_x,-str_x2,0,str_x2,str_x,str_x2,0,-str_x2];
 +
let temp_a2 = [0,0,-str_y2,-str_y,-str_y2,0,str_y2,str_y,str_y2];
 +
temp_c1 = temp_c1 < ran_n ? parseInt(Math.random()*7) + 1 : 0
 +
temp_obj.style.left = temp_a1[temp_c1] + "px";
 +
temp_obj.style.top = temp_a2[temp_c1] + "px";
 +
shake_times++;
 +
if(shake_times < max_t)
 +
{
 +
return 0;
 +
}
 +
fun_timer_clear("shake");
 +
temp_obj.style.left = "0px";temp_obj.style.top = "0px";
 +
shake_times = 0;
 +
}
 +
function timer_tween(target,c_w,c_h,c_x,c_y)
 +
{
 +
let temp_para,temp_obj;
 +
if(target == "back")
 +
{
 +
temp_para = data_back;
 +
temp_obj = document.getElementById("pic_back").lastElementChild;
 +
}
 +
else if(target == "image")
 +
{
 +
temp_para = data_image;
 +
temp_obj = document.getElementById("pic_image").lastElementChild;
 +
}
 +
temp_para.x += c_x;temp_para.y += c_y;
 +
temp_para.w += c_w;temp_para.h += c_h;
 +
if(temp_obj == undefined){fun_timer_clear(target);}
 +
temp_obj.style.backgroundPosition = temp_para.x + "px " + temp_para.y + "px";
 +
temp_obj.style.backgroundSize = temp_para.w + "px " + temp_para.h + "px";
 +
let temp_c1=temp_para.t_x-temp_para.x,temp_c2=temp_para.t_y-temp_para.y;
 +
let temp_c3=temp_para.t_w-temp_para.w,temp_c4=temp_para.t_h-temp_para.h;
 +
if((c_x>0 && temp_c1>0)||(c_x<0 && temp_c1<0)){return 0;}
 +
if((c_y>0 && temp_c2>0)||(c_y<0 && temp_c2<0)){return 0;}
 +
if((c_w>0 && temp_c3>0)||(c_w<0 && temp_c3<0)){return 0;}
 +
if((c_h>0 && temp_c4>0)||(c_h<0 && temp_c4<0)){return 0;}
 +
fun_timer_clear(target);
 +
temp_para.x = temp_para.t_x;temp_para.y = temp_para.t_y;
 +
temp_para.w = temp_para.t_w;temp_para.h = temp_para.t_h;
 +
temp_obj.style.backgroundPosition = temp_para.x + "px " + temp_para.y + "px";
 +
temp_obj.style.backgroundSize = temp_para.w + "px " + temp_para.h + "px";
 +
}
 +
function fun_animation_clear(obj_id)
 +
{
 +
if(obj_id == "pic_char_both")
 +
{
 +
document.getElementById("pic_char_left").style.animation = "";
 +
document.getElementById("pic_char_right").style.animation = "";
 +
return 0;
 +
}
 +
document.getElementById(obj_id).style.animation = "";
 +
}
 +
function fun_cal_len(temp_s1)
 +
{
 +
temp_s1 = temp_s1.replace(/[\u2013-\u201d\u2026\u3001-\u3015\u3040-\u30ff\u31f0-\u31ff\u4e00-\u9fa5\uff01-\uff1f]/g,"00");
 +
temp_s1 = temp_s1.replace("...","00");
 +
return temp_s1.length;
 +
}
 +
function fun_cal_rgb(c_r,c_g,c_b)
 +
{
 +
c_r = Math.max(0,c_r);c_g = Math.max(0,c_g);c_b = Math.max(0,c_b);
 +
let temp_a1 = [c_r,c_g,c_b];
 +
for (let num=0;num<3;num++)
 +
{
 +
if(temp_a1[num] <= 1) temp_a1[num]*=255;
 +
temp_a1[num] = temp_a1[num].toString(16);
 +
if(temp_a1[num] < 0x10)
 +
{
 +
temp_a1[num] = "0" + temp_a1[num];
 +
}
 +
}
 +
return "#" + temp_a1[0] + temp_a1[1] + temp_a1[2];
 +
}
 +
function fun_char_link(temp_data)
 +
{
 +
let place,temp_d1,temp_d2;
 +
if(temp_data.trim() == "" || temp_data == undefined)
 +
{
 +
console.error("The input parameter is empty,has skipped the data.");
 +
return [-1,-1];
 +
}
 +
place = temp_data.lastIndexOf("#");
 +
if(place > 0)
 +
{
 +
temp_d1 = temp_data.substr(0,place);
 +
temp_d2 = temp_data.substr(place + 1);
 +
try{
 +
temp_d2--;
 +
}
 +
catch(err){
 +
console.error("Data analyze error,use the default char to instead.");
 +
temp_d2 = 0;
 +
}
 +
if(data_link[temp_d1] == undefined)
 +
{
 +
console.error("The appointed data is not exist,has skipped the data.");
 +
return [-1,-1];
 +
}
 +
else if(data_link[temp_d1].array[temp_d2] == undefined)
 +
{
 +
console.warn("The analyze data is not exist,use the default char to instead.")
 +
temp_d2 = 0;
 +
}
 +
return [temp_d1,temp_d2];
 +
}
 +
place = temp_data.lastIndexOf("@");
 +
if(place > 0)
 +
{
 +
temp_d1 = temp_data.substr(0,place);
 +
temp_d2 = temp_data.substr(place + 1);
 +
for(place = 0;place<data_link[temp_d1].array.length;place++)
 +
{
 +
if(data_link[temp_d1].array[place].name == temp_d2)
 +
{
 +
return [temp_d1,place];
 +
}
 +
}
 +
if(place == data_link[temp_d1].length)
 +
{
 +
console.error("Data analyze error,use the default char to instead.");
 +
}
 +
}
 +
return [temp_data,0];
 +
}
 +
function fun_delay(key_cmd,key_time)
 +
{
 +
if(key_cmd == "block")
 +
{
 +
fun_setting("cmd_close");
 +
timer_id.wait = setTimeout(() => {
 +
fun_timer_clear("wait",1);
 +
fun_setting("cmd_open");
 +
txt_next();
 +
}, key_time*1000);
 +
}
 +
}
 +
function fun_get_url(temp_d1)
 +
{
 +
return temp_d1.replace(/^url\(["']|["']\)$/g,"")
 +
}
 +
function fun_setting(key_cmd)
 +
{
 +
if(key_cmd == "pre")
 +
{
 +
if (mw.config.values.debug == true)
 +
{
 +
txt_max = data_txt.length;
 +
console.log("txt_max=" + txt_max);
 +
}
 +
else if(txt_max == 0)
 
{
 
{
txt_temp = txt_temp + data_txt[txt_now].substr(txt_num,1);
+
txt_max = data_txt.length;
 
}
 
}
document.getElementById("txt_output").innerHTML = txt_temp;
+
reset_enabled = true;
txt_num++;
+
document.getElementById("txt_name").innerHTML = "";
return;
+
document.getElementById("txt_output").innerHTML = "";
 +
document.getElementById("playback_result").innerHTML = "";
 +
document.getElementById("system_dialog").style.display = "none";
 +
document.getElementById("button_reset").style.color = "";
 +
document.getElementById("system_blocker").style.opacity = 0;
 +
blocker_now = 0;
 +
}
 +
else if(key_cmd == "reset")
 +
{
 +
audio_stop("all");
 +
fun_timer_clear("back");
 +
fun_timer_clear("wait");
 +
fun_timer_clear("image");
 +
fun_timer_clear("blocker");
 +
fun_timer_clear("shake");
 +
document.getElementById("pic_back").innerHTML = "";
 +
document.getElementById("pic_image").innerHTML = "";
 +
document.getElementById("pic_char").innerHTML = "";
 +
document.getElementById("pic_cutin").innerHTML = "";
 +
document.getElementById("system_decision").style.display = "none";
 +
document.getElementById("system_camera").style.filter = "";
 +
document.getElementById("system_audio").innerHTML = "";
 +
document.getElementById("system_blocker").style = "";
 +
blocker_now = 1;blocker_new = 0;
 +
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 +
document.getElementById("system_dialog").style.display = "block";
 +
reset_enabled = false;
 +
fun_setting("cmd_open");
 +
document.getElementById("button_reset").style.color = "#808080"
 +
txt_num = 0;now_txt_max = 0;
 +
}
 +
else if(key_cmd == "cmd_close")
 +
{
 +
click_enabled = false;
 +
}
 +
else if(key_cmd == "cmd_open")
 +
{
 +
click_enabled = true;
 
}
 
}
// console.log("The timer has been stopped naturally.");
+
txt_stop();
+
}
if(flag_auto == true)
+
function fun_timer_clear(key_id,key_type)
 +
{
 +
if(timer_id[key_id] != undefined)
 
{
 
{
timer_id_wait = setTimeout("txt_next()",txt_num_max*80+1000)
+
if(key_type == 1)
 +
{
 +
clearTimeout(timer_id[key_id]);
 +
timer_id[key_id] = undefined;
 +
}
 +
else
 +
{
 +
clearInterval(timer_id[key_id]);
 +
timer_id[key_id] = undefined;
 +
}
 
}
 
}
 
}
 
}
 
function txt_check_test()
 
function txt_check_test()
 
{
 
{
if(data_txt[txt_now].match("^\\s+$")) //ONLY SPACE REGEX
+
if(data_txt[txt_num].match("^\\s+$") || data_txt[txt_num].match("^\\s*//.*$")) //ONLY SPACE REGEX|COMMENT REGEX
 
{
 
{
return -1;
+
return -2;
 
}
 
}
else if(data_txt[txt_now].match("^\\s*//.*$")) //COMMENT REGEX
+
let data_command = data_txt[txt_num].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
 +
let temp = [];
 +
if (data_command == null)
 
{
 
{
return -1;
+
temp.e1 = document.createElement("li");
 +
now_txt = data_txt[txt_num].replace(/{@[Nn]ickname}/g,data_nickname);
 +
temp.d1 = now_txt.replace(/\<(.*?)\>/g,"")
 +
now_txt = now_txt.replace("<color=","<font color=");
 +
now_txt = now_txt.replace("</color>","</font>");
 +
if(fun_cal_len(temp.d1) > 83)
 +
{
 +
temp.e1.style = "height:44px";
 +
}
 +
temp.e1.innerHTML = "<em>&nbsp;</em><span>" + now_txt + "</span>"
 +
document.getElementById("txt_name").innerHTML = ""
 +
document.getElementById("playback_result").append(temp.e1)
 +
document.getElementById("system_dialog").style.display = "block";
 +
return 0;
 
}
 
}
var data_command = data_txt[txt_now].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
+
else if(decision_mode == true)
 +
{
 +
temp.d1 = data_command[1] == undefined ? "" : data_command[1].toLowerCase();
 +
temp.d2 = data_command[3] == undefined ? "" : data_command[3].toLowerCase();
 +
if(temp.d1 != 'predicate' && temp.d2 != 'predicate')
 +
{
 +
return -2;
 +
}
 +
}
 +
console.log(data_command);
 
if (data_command[1] != undefined)
 
if (data_command[1] != undefined)
 
{
 
{
var command_set = {};
+
let command_set = [];
data_command[2] = data_command[2].replace(/\s+|["$]|#[^\,]+/g,"");
+
data_command[2] = data_command[2].replace(/["'\$]/g,"").replace(/(fadetiem)/g,"fadetime");
for (num of data_command[2].split(","))
+
console.log(data_command[2]);
 +
for (let temp_s1 of data_command[2].split(","))
 
{
 
{
var [type,value] = num.split("=");
+
let [p,v] = temp_s1.split("=");
command_set[type] = value;
+
if(p==""){continue;}
 +
p=p.toLowerCase().trim();
 +
if(v==undefined){continue;}
 +
command_set[p] = v.trim();
 
}
 
}
switch (data_command[1])
+
console.log(command_set);
 +
switch (data_command[1].toLowerCase())
 
{
 
{
case 'HEADER':
+
case 'background':
return -1;
+
temp.o1 = document.getElementById("pic_back");
 +
temp.c1 = command_set.fadetime == undefined ? 0.3 : command_set.fadetime;
 +
temp.c2 = temp.o1.childElementCount;
 +
temp.d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
 +
data_back.image = temp.d1;
 +
temp.e1 = document.createElement('div');
 +
data_back.now_obj = temp.e1;
 +
var size_x,size_y,pos_x,pos_y;
 +
fun_timer_clear("back_w",1);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.c1 > 0)
 +
{
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1"
 +
}
 +
}
 +
timer_id.back_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
break;
 +
}
 +
temp.d2 = command_set.xscale == undefined ? command_set.width == undefined ? 1 : command_set.width*1 : command_set.xscale*1;
 +
temp.d3 = command_set.yscale == undefined ? command_set.height == undefined ? 1 : command_set.height*1 : command_set.yscale*1;
 +
temp.d4 = command_set.x == undefined ? 0 : command_set.x*0.75;
 +
temp.d5 = command_set.y == undefined ? 0 : command_set.y*0.75;
 +
if(data_override_check('image',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.image[txt_page_name]["L" + temp_num];
 +
temp.d2 = temp_para.xscale == undefined ? temp.d2 : temp_para.xscale*1;
 +
temp.d3 = temp_para.yscale == undefined ? temp.d3 : temp_para.yscale*1;
 +
temp.d4 = temp_para.x == undefined ? temp.d4 : temp_para.x*0.75;
 +
temp.d5 = temp_para.y == undefined ? temp.d5 : temp_para.y*0.75;
 +
command_set.screenadapt = temp_para.screenadapt == undefined ? command_set.screenadapt : temp_para.screenadapt;
 +
}
 +
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 +
{
 +
console.warn("Image Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
data_back.ori_sx = temp.d2;data_back.ori_sy = temp.d3;
 +
data_back.ori_x = temp.d4;data_back.ori_y = temp.d5;
 +
console.log("xscale=" + data_back.ori_sx + ",yscale=" + data_back.ori_sy + ",x=" + data_back.ori_x + ",y=" + data_back.ori_y);
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
size_x = temp.i1.width*0.75;size_y = temp.i1.height*0.75;
 +
command_set.screenadapt = "coverall";
 +
if(command_set.screenadapt == "coverall")
 +
{
 +
let temp_w = size_x / 960,temp_h = size_y / 540;
 +
temp_w = Math.min(temp_w,temp_h);
 +
size_x /= temp_w;size_y /= temp_w;
 +
data_back.adapt = "coverall";
 +
}
 +
else data_back.adapt = "";
 +
pos_x = 480-size_x/2;pos_y = 270-size_y/2;
 +
temp.d5 = -temp.d5;
 +
console.log("size_x=" + temp.d2 + ",size_y=" + temp.d3 + ",pos_x=" + temp.d4 + ",pos_y=" + temp.d5);
 +
temp.e1.style.position = "absolute";
 +
temp.e1.style.width = size_x + "px";temp.e1.style.height = size_y + "px";
 +
temp.e1.style.left = pos_x + "px";temp.e1.style.top = pos_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.transform = "matrix("+temp.d2+",0,0,"+temp.d3+","+temp.d4+","+temp.d5+")";
 +
temp.o1.appendChild(temp.e1);
 +
temp.o1.style.display = "block";
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
for(let num=0;num<temp.c2;num++)
 +
{
 +
temp.o1.childNodes[0].remove();
 +
}
 +
}, temp.c1*1000);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'PlayMusic':
+
case 'backgroundtween':
return -1;
+
temp.d1 = command_set.image == undefined ? data_back.image == undefined ? "" : data_back.image : command_set.image.toLowerCase();
 +
temp.c1 = command_set.duration == undefined ? 0.3 : command_set.duration;
 +
temp.o1 = data_back.now_obj;
 +
fun_timer_clear("back");
 +
if(temp.o1 == undefined) return -1;
 +
if(temp.c1 < 0.05)
 +
{
 +
temp.c1 = 0.05;
 +
}
 +
if(temp.d1 == "") return -1;
 +
temp.d1 = command_set.xscalefrom == undefined ? command_set.xscale == undefined ? data_back.ori_sx : command_set.xscale*1 : command_set.xscalefrom*1;
 +
temp.d2 = command_set.yscalefrom == undefined ? command_set.yscale == undefined ? data_back.ori_sy : command_set.yscale*1 : command_set.yscalefrom*1;
 +
temp.d3 = command_set.xscaleto == undefined ? command_set.xscale == undefined ? data_back.ori_sx : command_set.xscale*1 : command_set.yscaleto*1;
 +
temp.d4 = command_set.yscaleto == undefined ? command_set.yscale == undefined ? data_back.ori_sy : command_set.yscale*1 : command_set.yscaleto*1;
 +
temp.d5 = command_set.xfrom == undefined ? command_set.x == undefined ? data_back.ori_x : command_set.x*0.75 : command_set.xfrom*0.75;
 +
temp.d6 = command_set.yfrom == undefined ? command_set.y == undefined ? data_back.ori_y : command_set.y*0.75 : command_set.yfrom*0.75;
 +
temp.d7 = command_set.xto == undefined ? command_set.x == undefined ? data_back.ori_x : command_set.x*0.75 : command_set.xto*0.75;
 +
temp.d8 = command_set.yto == undefined ? command_set.y == undefined ? data_back.ori_y : command_set.y*0.75 : command_set.yto*0.75;
 +
if(data_override_check('tween',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.tween[txt_page_name]["L" + temp_num];
 +
temp.d1 = temp_para.xscalefrom == undefined ? temp_para.xscale == undefined ? temp.d1 : temp_para.xscale*1 : temp_para.xscalefrom*1;
 +
temp.d2 = temp_para.yscalefrom == undefined ? temp_para.yscale == undefined ? temp.d2 : temp_para.yscale*1 : temp_para.yscalefrom*1;
 +
temp.d3 = temp_para.xscaleto == undefined ? temp_para.xscale == undefined ? temp.d3 : temp_para.xscale*1 : temp_para.yscaleto*1;
 +
temp.d4 = temp_para.yscaleto == undefined ? temp_para.yscale == undefined ? temp.d4 : temp_para.yscale*1 : temp_para.yscaleto*1;
 +
temp.d5 = temp_para.xfrom == undefined ? temp_para.x == undefined ? temp.d5 : temp_para.x*0.75 : temp_para.xfrom*0.75;
 +
temp.d6 = temp_para.yfrom == undefined ? temp_para.y == undefined ? temp.d6 : temp_para.y*0.75 : temp_para.yfrom*0.75;
 +
temp.d7 = temp_para.xto == undefined ? temp_para.x == undefined ? temp.d7 : temp_para.x*0.75 : temp_para.xto*0.75;
 +
temp.d8 = temp_para.yto == undefined ? temp_para.y == undefined ? temp.d8 : temp_para.y*0.75 : temp_para.yto*0.75;
 +
}
 +
temp.d6 = -temp.d6;temp.d8 = -temp.d8;
 +
temp.o1.style.transform = "matrix("+temp.d1+",0,0,"+temp.d2+","+temp.d5+","+temp.d6+")";
 +
temp.o1.style.transition = temp.c1 + "s linear"
 +
setTimeout(() => {
 +
temp.o1.style.transform = "matrix("+temp.d3+",0,0,"+temp.d4+","+temp.d7+","+temp.d8+")";
 +
}, 20);
 +
console.log("transform from:xscale=" + temp.d1 + ",yscale=" + temp.d2 + ",x=" + temp.d5 + ",y=" + temp.d6);
 +
console.log("transform to:xscale=" + temp.d3 + ",yscale=" + temp.d4 + ",x=" + temp.d7 + ",y=" + temp.d8);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'StopMusic':
+
case 'blocker':
return -1;
+
temp.c1 = command_set.fadetime == undefined ? 0.4 : command_set.fadetime;//默认12帧过渡时间
 +
temp.d1 = command_set.a == undefined ? 1 : command_set.a*1;
 +
temp.d2 = command_set.r == undefined ? 0 : command_set.r;
 +
temp.d3 = command_set.g == undefined ? 0 : command_set.g;
 +
temp.d4 = command_set.b == undefined ? 0 : command_set.b;
 +
if(temp.d1 > 1) //闲着没事的以防万一
 +
{
 +
temp.d1 = 1;
 +
}
 +
if(temp.c1 < 0.05)
 +
{
 +
console.warn("fadetime is too short,use the minimum capacity to instead.");
 +
temp.c1 = 0.05;
 +
}
 +
blocker_new = temp.d1;
 +
temp.c2 = (blocker_new - blocker_now) / temp.c1 / 30;
 +
temp.c2 = temp.c2.toFixed(3);temp.c2*=1;
 +
document.getElementById("system_blocker").style.backgroundColor = fun_cal_rgb(temp.d2,temp.d3,temp.d4);
 +
fun_timer_clear("blocker");
 +
timer_id.blocker = setInterval(() => {
 +
timer_blocker(temp.c2);
 +
},33);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'Delay':
+
case 'cameraeffect':
if (command_set.time == undefined)
+
temp.d1 = command_set.effect == undefined ? "grayscale" : command_set.effect.toLowerCase();
 +
temp.d2 = command_set.amount == undefined ? 0 : command_set.amount;
 +
temp.o1 = document.getElementById("system_camera");
 +
if(temp.d2 == 0){temp.o1.style.filter = "";}
 +
switch(temp.d1)
 
{
 
{
return -1;
+
case 'grayscale':
 +
temp.o1.style.filter = "grayscale(" + temp.d2 + ")";
 +
break;
 +
default:
 +
temp.o1.style.filter = "";
 
}
 
}
setTimeout("txt_next()",command_set.time*1000);
 
return -2;
 
 
break;
 
break;
case 'Blocker':
+
case 'camerashake':
return -1;
+
temp.c1 = command_set.duration == undefined ? 0.2 : command_set.duration;
 +
temp.d1 = command_set.xstrength == undefined ? 0 : command_set.xstrength * 0.6;
 +
temp.d2 = command_set.ystrength == undefined ? 0 : command_set.ystrength * 0.6;
 +
temp.d3 = command_set.randomness == undefined ? 90 : command_set.randomness;
 +
temp.d4 = command_set.stop == undefined ? "false" : command_set.stop;
 +
fun_timer_clear("shake");
 +
if(command_set.stop == "true") return 1;
 +
if(temp.c1 < 0.05)
 +
{
 +
console.warn("The duration is too short,use the minimum value to instead.");
 +
temp.c1 = 0.05;
 +
}
 +
console.log("duration=" + temp.c1 + ",xstrength=" + temp.d1 + ",ystrength=" + temp.d2 + ",randomness=" + temp.d3);
 +
timer_id.shake = setInterval(() => {
 +
timer_shake(temp.d1,temp.d2,temp.d3,temp.c1*20);
 +
},50);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'Decision':
+
case 'character':
return -1;
+
temp.o1 = document.getElementById("pic_char");
break;
+
temp.c1 = command_set.fadetime == undefined ? 0 : command_set.fadetime;
case 'Predicate':
+
temp.c2 = temp.o1.childElementCount;
return -1;
+
temp.d1 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
break;
+
temp.d2 = command_set.name2 == undefined ? "" : command_set.name2.toLowerCase();
case 'Background':
+
temp.d3 = command_set.block == undefined ? "false" : command_set.block;
var obj_image = document.getElementById("pic_image");
+
temp.d4 = command_set.focus == undefined ? "0" : command_set.focus;
if(command_set.image == undefined)
+
var pos_x,pos_y,size_x,size_y;
 +
fun_timer_clear("char_w",1)
 +
if(temp.d1 == "")
 
{
 
{
obj_back.style.display = "none";
+
if(temp.c1 > 0)
 +
{
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1";
 +
}
 +
}
 +
timer_id.char_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
if(temp.d3 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
 
}
 
}
obj_back.innerHTML = "<img alt=\"" + command_set.image + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.image] + "\">";
+
else
obj_back.style.display = "block";
+
{
 +
if(data_override_check('char',temp.d1,txt_num) == true)
 +
{
 +
temp.d1 = data_override.char[temp.d1].name;
 +
}
 +
[temp.d5,temp.d6] = fun_char_link(temp.d1);
 +
console.log("[char_1]name=" + temp.d5 + ",index=" + temp.d6);
 +
if(temp.d5 == -1){return -1;}
 +
temp.e1 = document.createElement("div");
 +
temp.e1.id = "char_1";
 +
temp.e1.className = "pic_style";
 +
temp.d1 = data_link[temp.d5].array[temp.d6].default;
 +
if(data_pic_char[temp.d1] == undefined || data_pic_char[temp.d1] == "")
 +
{
 +
console.warn("Char Data:" + temp.d1 + " is not exist,please check the data list.");
 +
}
 +
pos_x = data_link[temp.d5].pos.x * 0.75;
 +
pos_y = data_link[temp.d5].pos.y * 0.75;
 +
size_x = data_link[temp.d5].scale.x * 0.75;
 +
size_y = data_link[temp.d5].scale.y * 0.75;
 +
if (temp.d4 == -1 || temp.d4 == 2)
 +
{
 +
temp.e1.style.filter = "brightness(50%)";
 +
temp.e1.style.zIndex = -1;
 +
}
 +
pos_x = temp.d2 == "" ? 480-size_x/2+pos_x : 330-size_x/2+pos_x;
 +
pos_y = 540-size_y/2-pos_y;
 +
temp.e1.style.backgroundPosition = pos_x + "px " + pos_y + "px";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_char[temp.d1] + "')";
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
fun_animation_clear("char_1");
 +
},temp.c1*1000);
 +
}
 +
}
 +
if(temp.d2 != "")
 +
{
 +
if(data_override_check('char',temp.d2,txt_num) == true)
 +
{
 +
temp.d2 = data_override.char[temp.d2].name;
 +
}
 +
[temp.d5,temp.d6] = fun_char_link(temp.d2);
 +
console.log("[char_2]name=" + temp.d5 + ",index=" + temp.d6);
 +
if(temp.d5 == -1){return -1;}
 +
temp.e1 = document.createElement("div");
 +
temp.e1.id = "char_2";
 +
temp.e1.className = "pic_style";
 +
temp.d2 = data_link[temp.d5].array[temp.d6].default;
 +
if(data_pic_char[temp.d2] == undefined || data_pic_char[temp.d2] == "")
 +
{
 +
console.warn("Char Data:" + temp.d2 + " is not exist,please check the data list.");
 +
}
 +
pos_x = data_link[temp.d5].pos.x * 0.75;
 +
pos_y = data_link[temp.d5].pos.y * 0.75;
 +
size_x = data_link[temp.d5].scale.x * 0.75;
 +
size_y = data_link[temp.d5].scale.y * 0.75;
 +
pos_x = 630-size_x/2+pos_x;
 +
pos_y = 540-size_y/2-pos_y;
 +
if (temp.d4 == 1)
 +
{
 +
temp.e1.style.filter = "brightness(50%)";
 +
temp.e1.style.zIndex = -1;
 +
}
 +
temp.e1.style.backgroundPosition = pos_x + "px " + pos_y + "px";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_char[temp.d2] + "')";
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
fun_animation_clear("char_2");
 +
},temp.c1*1000);
 +
}
 +
}
 +
for(let num = 0;num < temp.c2;num++)
 +
{
 +
temp.o1.childNodes[0].remove();
 +
}
 +
if(temp.d3 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'Image':
+
case 'charactercutin':
var obj_back = document.getElementById("pic_back");
+
temp.o1 = document.getElementById("pic_cutin");
var obj_image = document.getElementById("pic_image");
+
if(command_set.widgetid == undefined)
if(command_set.image == undefined)
 
 
{
 
{
obj_back.style.display = "block";
+
temp.o1.innerHTML = "";
obj_image.style.display = "none";
+
return -1;
 +
}
 +
temp.c1 = command_set.fadetime == undefined ? 0.28 : command_set.fadetime;
 +
temp.d1 = command_set.name == undefined ? "" : command_set.name.toLowerCase();
 +
temp.d2 = "cutin_" + command_set.widgetid;
 +
temp.d4 = command_set.offsetx == undefined ? 480 : 480+command_set.offsetx*0.75;
 +
temp.d5 = command_set.width == undefined ? 150 : command_set.width*0.75;
 +
temp.d6 = command_set.height == undefined ? 540 : command_set.height*0.75;
 +
temp.d10 = command_set.block == undefined ? "false" : command_set.block;
 +
var size_x,size_y;
 +
temp.o2 = document.getElementById(temp.d2);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.o2 == undefined){return -1;}
 +
data_cutin[temp.d2].times = temp.c1 < 0.02 ? 1 : temp.c1*50;
 +
data_cutin[temp.d2].state = "hide";
 +
if(data_cutin[temp.d2].style == 0)
 +
{
 +
temp.o2.style.animation = "fade-out " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.o2.remove();
 +
},temp.c1);
 +
}
 +
else
 +
{
 +
timer_id.cutin = setInterval(() => {
 +
timer_cutin(temp.d2);
 +
}, 20);
 +
}
 +
if(temp.d10 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
 
}
 
}
obj_back.style.display = "none";
+
data_cutin[temp.d2] = [];
obj_image.innerHTML = "<img alt=\"" + command_set.image + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.image] + "\">";
+
data_cutin[temp.d2].state = "show";
obj_image.style.display = "block";
+
data_cutin[temp.d2].times = temp.c1 < 0.02 ? 1 : temp.c1*50;
 +
data_cutin[temp.d2].width = temp.d5;
 +
data_cutin[temp.d2].height = temp.d6;
 +
data_cutin[temp.d2].offsetx = temp.d4;
 +
if(temp.o2 == undefined)
 +
{
 +
temp.o2 = document.createElement('div');
 +
temp.o2.id = temp.d2;
 +
temp.o2.className = "cutin_style";
 +
temp.o1.append(temp.o2);
 +
}
 +
switch(command_set.fadestyle)
 +
{
 +
case 'horiz_expand_center':
 +
data_cutin[temp.d2].style = 1;
 +
temp.d7 = temp.d4;
 +
temp.d8 = 0;
 +
break;
 +
case 'horiz_expand_left2right':
 +
data_cutin[temp.d2].style = 2;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = 0;
 +
break;
 +
case 'horiz_expand_right2left':
 +
data_cutin[temp.d2].style = 3;
 +
temp.d7 = temp.d4+temp.d5/2;
 +
temp.d8 = 0;
 +
case 'vert_expand_center':
 +
data_cutin[temp.d2].style = 4;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = temp.d6/2;
 +
break;
 +
case 'vert_expand_top2buttom':
 +
data_cutin[temp.d2].style = 5;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = 0;
 +
break;
 +
case 'vert_expand_buttom2top':
 +
data_cutin[temp.d2].style = 6;
 +
temp.d7 = temp.d4-temp.d5/2;
 +
temp.d8 = temp.d6;
 +
break;
 +
default:
 +
data_cutin[temp.d2].style = 0;
 +
temp.d7 = temp.d5-temp.d5/2;
 +
temp.d8 = 0;
 +
}
 +
//data_cutin[temp.d2].left = temp.d7;data_cutin[temp.d2].top = temp.d8;
 +
temp.o2.style.left = temp.d7 + "px";
 +
temp.o2.style.top = temp.d8 + "px";
 +
[temp.d7,temp.d8] = fun_char_link(temp.d1);
 +
if(temp.d7 == -1){return -1;}
 +
size_x = data_link[temp.d7].scale.x * 0.75;
 +
size_y = data_link[temp.d7].scale.y * 0.75;
 +
temp.d1 = data_link[temp.d7].array[temp.d8].default;
 +
if(data_pic_char[temp.d1] == undefined || data_pic_char[temp.d1] == "")
 +
{
 +
console.warn("Char Data:" + temp.d1 + " is not exist,please check the data list.");
 +
}
 +
temp.o2.style.backgroundSize =  size_x + "px " + size_y + "px";
 +
temp.o2.style.backgroundImage = "url('" + data_pic_char[temp.d1] + "')";
 +
if(data_cutin[temp.d2].style > 0 && data_cutin[temp.d2].style <= 3)
 +
{
 +
temp.o2.style.width = "0px";
 +
temp.o2.style.height = temp.d6 + "px";
 +
}
 +
else if(data_cutin[temp.d2].style > 3 && data_cutin[temp.d2].style <=6)
 +
{
 +
temp.o2.style.width = temp.d5 + "px";
 +
temp.o2.style.height = "0px";
 +
}
 +
if(data_cutin[temp.d2].style == 0)
 +
{
 +
temp.o2.style.width = temp.d5 + "px";
 +
temp.o2.style.height = temp.d6 + "px";
 +
temp.o2.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.o2.style.animation = "";
 +
},temp.c1);
 +
}
 +
else
 +
{
 +
timer_id.cutin = setInterval(() => {
 +
timer_cutin(temp.d2);
 +
}, 20);
 +
}
 +
if(temp.d10 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'ImageTween':
+
case 'delay':
 +
if (command_set.time == undefined){return -1;}
 +
fun_delay("block",command_set.time);
 +
return 2;
 +
case 'decision':
 +
if(command_set.options == undefined){return -1;}
 +
temp.d1 = command_set.options.split(";");
 +
temp.c1 = command_set.values.split(";");
 +
for (let num=1;num<4;num++)
 +
{
 +
temp["o"+num] = document.getElementById("decision_" + num);
 +
temp["o"+num].style.top = 72*(num+1) + "px"
 +
temp["o"+num].style.fontSize = "";
 +
}
 +
switch (temp.d1.length)
 +
{
 +
case 1:
 +
decision_value = [-1,temp.c1[0],-1];
 +
temp.o1.innerHTML = "&nbsp;"
 +
temp.o1.style.display = "none";
 +
temp.o2.innerHTML = temp.d1[0];
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o2.style.fontSize = "10px";
 +
}
 +
temp.o2.style.display = "block";
 +
temp.o3.innerHTML = "&nbsp;"
 +
temp.o3.style.display = "none";
 +
break;
 +
case 2:
 +
decision_value = [temp.c1[0],-1,temp.c1[1]];
 +
temp.o1.innerHTML = temp.d1[0];
 +
temp.o1.style.top = "180px";
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o1.style.fontSize = "10px";
 +
}
 +
temp.o1.style.display = "block";
 +
temp.o2.innerHTML = "&nbsp;"
 +
temp.o2.style.display = "none";
 +
temp.o3.innerHTML = temp.d1[1];
 +
temp.o3.style.top = "252px";
 +
if(fun_cal_len(temp.d1[1]) > 32)
 +
{
 +
temp.o3.style.fontSize = "10px";
 +
}
 +
temp.o3.style.display = "block";
 +
break;
 +
case 3:
 +
decision_value = [temp.c1[0],temp.c1[1],temp.c1[2]];
 +
temp.o1.innerHTML = temp.d1[0];
 +
if(fun_cal_len(temp.d1[0]) > 32)
 +
{
 +
temp.o1.style.fontSize = "10px";
 +
}
 +
temp.o1.style.display = "block";
 +
temp.o2.innerHTML = temp.d1[1];
 +
if(fun_cal_len(temp.d1[1]) > 32)
 +
{
 +
temp.o2.style.fontSize = "10px";
 +
}
 +
temp.o2.style.display = "block";
 +
temp.o3.innerHTML = temp.d1[2];
 +
if(fun_cal_len(temp.d1[2]) > 32)
 +
{
 +
temp.o3.style.fontSize = "10px";
 +
}
 +
temp.o3.style.display = "block";
 +
break;
 +
default:
 +
console.error("decision data error.");
 +
return -1;
 +
}
 +
if(flag_auto == true)
 +
{
 +
fun_timer_clear("auto");
 +
}
 +
fun_setting("cmd_close");
 +
document.getElementById("system_decision").style.display = "block";
 +
return 2;
 +
case 'header':
 
return -1;
 
return -1;
 +
case 'hideitem':
 +
temp.o1 = document.getElementById("pic_item").lastElementChild;
 +
temp.d1 = command_set.block == undefined ? "true" : command_set.block;
 +
temp.c1 = command_set.fadetime == undefined ? 0.32 : command_set.fadetime;
 +
if(temp.o1 == undefined){return -1;}
 +
temp.o1.style.animation = "fade-out " + temp.c1 + "s 1";
 +
setTimeout(() => {
 +
temp.o1.remove();
 +
}, temp.c1*950);
 +
if(temp.d1 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 
break;
 
break;
case 'CameraShake':
+
case 'image':
return -1;
+
temp.o1 = document.getElementById("pic_image");
break;
+
temp.c1 = command_set.fadetime == undefined ? 0.3 : command_set.fadetime;
case 'Character':
+
temp.c2 = temp.o1.childElementCount;
obj_char_1 = document.getElementById("pic_char_1");
+
temp.d1 = command_set.image == undefined ? "" : command_set.image.toLowerCase();
obj_char_2 = document.getElementById("pic_char_2");
+
data_image.image = temp.d1;
if (command_set.name == undefined)
+
temp.e1 = document.createElement('div');
 +
data_image.now_obj = temp.e1;
 +
var size_x,size_y,pos_x,pos_y;
 +
fun_timer_clear("image_w",1);
 +
if(temp.d1 == "")
 +
{
 +
if(temp.c1 > 0)
 +
{
 +
for(let num=0;num<temp.c2;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType == 1)
 +
{
 +
temp.o1.childNodes[num].style.animation = "fade-out " + temp.c1 + "s 1"
 +
}
 +
}
 +
timer_id.image_w = setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, temp.c1*950);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
}
 +
else
 +
{
 +
temp.o1.innerHTML = "";
 +
}
 +
break;
 +
}
 +
temp.d2 = command_set.xscale == undefined ? command_set.width == undefined ? 1 : command_set.width*1 : command_set.xscale*1;
 +
temp.d3 = command_set.yscale == undefined ? command_set.height == undefined ? 1 : command_set.height*1 : command_set.yscale*1;
 +
temp.d4 = command_set.x == undefined ? 0 : command_set.x*0.75;
 +
temp.d5 = command_set.y == undefined ? 0 : command_set.y*0.75;
 +
if(data_override_check('image',txt_page_name,txt_num) == true)
 
{
 
{
obj_char_1.style.display = "none";
+
let temp_num = txt_num + 1;
obj_char_2.style.display = "none";
+
let temp_para = data_override.image[txt_page_name]["L" + temp_num];
 +
temp.d2 = temp_para.xscale == undefined ? temp.d2 : temp_para.xscale*1;
 +
temp.d3 = temp_para.yscale == undefined ? temp.d3 : temp_para.yscale*1;
 +
temp.d4 = temp_para.x == undefined ? temp.d4 : temp_para.x*0.75;
 +
temp.d5 = temp_para.y == undefined ? temp.d5 : temp_para.y*0.75;
 +
command_set.screenadapt = temp_para.screenadapt == undefined ? command_set.screenadapt : temp_para.screenadapt;
 
}
 
}
else if (command_set.name2 == undefined)
+
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 
{
 
{
obj_char_1.style.display = "block";
+
console.warn("Image Data:" + temp.d1 + " is not exist,please check the data list.");
obj_char_2.style.display = "none";
+
return -1;
document.getElementById("pic_char").innerHTML = "<img alt=\"" + command_set.name + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.name] + "\">";
 
 
}
 
}
else
+
data_image.ori_sx = temp.d2;data_image.ori_sy = temp.d3;
 +
data_image.ori_x = temp.d4;data_image.ori_y = temp.d5;
 +
console.log("xscale=" + data_image.ori_sx + ",yscale=" + data_image.ori_sy + ",x=" + data_image.ori_x + ",y=" + data_image.ori_y);
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
size_x = temp.i1.width*0.75;size_y = temp.i1.height*0.75;
 +
if(command_set.screenadapt == "coverall")
 
{
 
{
var char_left = document.getElementById("pic_char_left");
+
let temp_w = size_x / 960,temp_h = size_y / 540;
var char_right = document.getElementById("pic_char_right");
+
temp_w = Math.min(temp_w,temp_h);
if (command_set.focus == undefined)
+
size_x /= temp_w;size_y /= temp_w;
 +
data_image.adapt = "coverall";
 +
}
 +
else data_image.adapt = "";
 +
pos_x = 480-size_x/2;pos_y = 270-size_y/2;
 +
temp.d5 = -temp.d5;
 +
console.log("size_x=" + temp.d2 + ",size_y=" + temp.d3 + ",pos_x=" + temp.d4 + ",pos_y=" + temp.d5);
 +
temp.e1.style.position = "absolute";
 +
temp.e1.style.width = size_x + "px";temp.e1.style.height = size_y + "px";
 +
temp.e1.style.left = pos_x + "px";temp.e1.style.top = pos_y + "px";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = size_x + "px " + size_y + "px";
 +
temp.e1.style.transform = "matrix("+temp.d2+",0,0,"+temp.d3+","+temp.d4+","+temp.d5+")";
 +
temp.o1.appendChild(temp.e1);
 +
temp.o1.style.display = "block";
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
for(let num=0;num<temp.c2;num++)
 
{
 
{
char_left.style.display = "block";
+
temp.o1.childNodes[0].remove();
char_right.style.display = "block";
 
 
}
 
}
else if (command_set.focus == 1)
+
}, temp.c1*1000);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'imagetween':
 +
temp.d1 = command_set.image == undefined ? data_image.image == undefined ? "" : data_image.image : command_set.image.toLowerCase();
 +
temp.c1 = command_set.duration == undefined ? 0.3 : command_set.duration;
 +
temp.o1 = data_image.now_obj;
 +
if(temp.o1 == undefined) return -1;
 +
if(temp.c1 < 0.05)
 +
{
 +
temp.c1 = 0.05;
 +
}
 +
if(temp.d1 == "") return -1;
 +
temp.d1 = command_set.xscalefrom == undefined ? command_set.xscale == undefined ? data_image.ori_sx : command_set.xscale*1 : command_set.xscalefrom*1;
 +
temp.d2 = command_set.yscalefrom == undefined ? command_set.yscale == undefined ? data_image.ori_sy : command_set.yscale*1 : command_set.yscalefrom*1;
 +
temp.d3 = command_set.xscaleto == undefined ? command_set.xscale == undefined ? data_image.ori_sx : command_set.xscale*1 : command_set.yscaleto*1;
 +
temp.d4 = command_set.yscaleto == undefined ? command_set.yscale == undefined ? data_image.ori_sy : command_set.yscale*1 : command_set.yscaleto*1;
 +
temp.d5 = command_set.xfrom == undefined ? command_set.x == undefined ? data_image.ori_x : command_set.x*0.75 : command_set.xfrom*0.75;
 +
temp.d6 = command_set.yfrom == undefined ? command_set.y == undefined ? data_image.ori_y : command_set.y*0.75 : command_set.yfrom*0.75;
 +
temp.d7 = command_set.xto == undefined ? command_set.x == undefined ? data_image.ori_x : command_set.x*0.75 : command_set.xto*0.75;
 +
temp.d8 = command_set.yto == undefined ? command_set.y == undefined ? data_image.ori_y : command_set.y*0.75 : command_set.yto*0.75;
 +
if(data_override_check('tween',txt_page_name,txt_num) == true)
 +
{
 +
let temp_num = txt_num + 1;
 +
let temp_para = data_override.tween[txt_page_name]["L" + temp_num];
 +
temp.d1 = temp_para.xscalefrom == undefined ? temp_para.xscale == undefined ? temp.d1 : temp_para.xscale*1 : temp_para.xscalefrom*1;
 +
temp.d2 = temp_para.yscalefrom == undefined ? temp_para.yscale == undefined ? temp.d2 : temp_para.yscale*1 : temp_para.yscalefrom*1;
 +
temp.d3 = temp_para.xscaleto == undefined ? temp_para.xscale == undefined ? temp.d3 : temp_para.xscale*1 : temp_para.yscaleto*1;
 +
temp.d4 = temp_para.yscaleto == undefined ? temp_para.yscale == undefined ? temp.d4 : temp_para.yscale*1 : temp_para.yscaleto*1;
 +
temp.d5 = temp_para.xfrom == undefined ? temp_para.x == undefined ? temp.d5 : temp_para.x*0.75 : temp_para.xfrom*0.75;
 +
temp.d6 = temp_para.yfrom == undefined ? temp_para.y == undefined ? temp.d6 : temp_para.y*0.75 : temp_para.yfrom*0.75;
 +
temp.d7 = temp_para.xto == undefined ? temp_para.x == undefined ? temp.d7 : temp_para.x*0.75 : temp_para.xto*0.75;
 +
temp.d8 = temp_para.yto == undefined ? temp_para.y == undefined ? temp.d8 : temp_para.y*0.75 : temp_para.yto*0.75;
 +
}
 +
temp.d6 = -temp.d6;temp.d8 = -temp.d8;
 +
temp.o1.style.transform = "matrix("+temp.d1+",0,0,"+temp.d2+","+temp.d5+","+temp.d6+")";
 +
temp.o1.style.transition = temp.c1 + "s linear"
 +
setTimeout(() => {
 +
temp.o1.style.transform = "matrix("+temp.d3+",0,0,"+temp.d4+","+temp.d7+","+temp.d8+")";
 +
}, 20);
 +
console.log("transform from:xscale=" + temp.d1 + ",yscale=" + temp.d2 + ",x=" + temp.d5 + ",y=" + temp.d6);
 +
console.log("transform to:xscale=" + temp.d3 + ",yscale=" + temp.d4 + ",x=" + temp.d7 + ",y=" + temp.d8);
 +
if(command_set.block == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'playmusic':
 +
temp.o1 = document.getElementById("system_music");
 +
temp.c1 = command_set.delay == undefined ? 0 : command_set.delay * 1000;
 +
temp.d1 = command_set.intro == undefined ? "" : command_set.intro.toLowerCase();
 +
temp.d2 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
fun_timer_clear("music");
 +
temp.o1.volume = command_set.volume == undefined ? 0.4 : Math.min(command_set.volume*0.5,1);
 +
if(temp.d1 == "")
 +
{
 +
console.warn("Music intro is not exist.");
 +
if(temp.d2 != "" && data_audio[temp.d2] != undefined)
 
{
 
{
char_left.style.display = "block";
+
temp.o1.src = data_audio[temp.d2];
char_right.style.display = "none";
+
temp.o1.loop = true;
 +
setTimeout(() => {
 +
temp.o1.play();
 +
},temp.c1);
 +
break;
 
}
 
}
else if(command_set.focus ==2)
+
return -1;
{
+
}
char_left.style.display = "none";
+
else if(data_audio[temp.d1] == undefined)
char_right.style.display = "block";
+
{
}
+
console.warn("Audio Data:" + temp.d1 + " is not exist,please check the data list.");
obj_char_1.style.display = "none";
+
return -1;
obj_char_2.style.display = "block";
+
}
char_left.innerHTML = "<img alt=\"" + command_set.name + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.name] + "\">";
+
temp.o1.src = data_audio[temp.d1];
char_right.innerHTML = "<img alt=\"" + command_set.name2 + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.name2] + "\">";
+
if(temp.d2 == "")
 +
{
 +
console.warn("Music key is no exist,has use the intro to instead.");
 +
music_loop = data_audio[temp.d1];
 +
}
 +
else
 +
{
 +
music_loop = data_audio[temp.d2];
 +
}
 +
temp.o1.loop = false;
 +
setTimeout(() => {
 +
temp.o1.play();
 +
temp.o1.onended = () => {
 +
temp.o1.src = music_loop;
 +
temp.o1.loop = true;
 +
temp.o1.play();
 +
};
 +
},temp.c1);
 +
break;
 +
case 'playsound':
 +
temp.o1 = new Audio();
 +
temp.c1 = command_set.delay == undefined ? 0 : command_set.delay * 1000;
 +
temp.d1 = command_set.key == undefined ? "" : command_set.key.toLowerCase();
 +
if(temp.d1 == "")
 +
{
 +
console.error("Command Analyze error:Audio is not exist.");
 +
return -1;
 +
}
 +
else if(data_audio[temp.d1] == undefined)
 +
{
 +
console.warn("Audio Data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
temp.o1.volume = command_set.volume == undefined ? 0.5 : Math.min(command_set.volume*0.5,1);
 +
temp.o1.src = data_audio[temp.d1];
 +
document.getElementById("system_audio").appendChild(temp.o1);
 +
setTimeout(() => {
 +
temp.o1.play();
 +
temp.o1.onended = () => {
 +
document.getElementById("system_audio").removeChild(temp.o1);
 +
};
 +
}, temp.c1);
 +
break;
 +
case 'predicate':
 +
if (command_set.references == undefined)
 +
{
 +
decision_mode = false;
 +
break;
 +
}
 +
if (command_set.references.includes(decision_select) == true)
 +
{
 +
decision_mode = false;
 +
break;
 +
}
 +
decision_mode = true;
 +
break;
 +
case 'showitem':
 +
temp.o1 = document.getElementById("pic_item");
 +
temp.d1 = command_set.image == undefined ? "" : command_set.image;
 +
temp.d2 = command_set.block == undefined ? "true" : command_set.block;
 +
temp.c1 = command_set.fadetime == undefined ? 0.32 : command_set.fadetime*1;
 +
if(temp.d1 == ""){return -1;}
 +
if(data_pic_back[temp.d1] == undefined || data_pic_back[temp.d1] == "")
 +
{
 +
console.warn("Item data:" + temp.d1 + " is not exist,please check the data list.");
 +
return -1;
 +
}
 +
temp.i1 = new Image();
 +
temp.i1.src = data_pic_back[temp.d1];
 +
temp.c2 = temp.i1.width*0.6;temp.c3 = temp.i1.height*0.6;
 +
temp.c4 = (960-temp.c2)/2-7.5;temp.c5 = (540-temp.c3)/2-7.5;
 +
temp.e1 = document.createElement('div');
 +
temp.e1.className = "item_style";
 +
temp.e1.style.backgroundImage = "url('" + data_pic_back[temp.d1] + "')";
 +
temp.e1.style.backgroundSize = "100% 100%";
 +
temp.e1.style.width = temp.c2 + "px";temp.e1.style.height = temp.c3 + "px";
 +
temp.e1.style.left = temp.c4 + "px";temp.e1.style.top = temp.c5 + "px";
 +
console.log("fadetime=" + temp.c1 + ",width=" + temp.c2 + ",height=" + temp.c3 + ",left=" + temp.c4 + ",top=" + temp.c5);
 +
if(temp.c1 > 0)
 +
{
 +
temp.e1.style.animation = "fade-in " + temp.c1 + "s 1"
 +
setTimeout(() => {
 +
temp.e1.style.animation = "";
 +
},temp.c1*1000);
 +
}
 +
temp.o1.appendChild(temp.e1);
 +
if(temp.d2 == "true")
 +
{
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
break;
 +
case 'stopmusic':
 +
temp.d1 = command_set.fadetime == undefined ? 6 : command_set.fadetime * 30;
 +
temp.c1 = document.getElementById("system_music").volume;
 +
if(temp.d1 > 0)
 +
{
 +
temp.c1 /= temp.d1;
 +
timer_id.music = setInterval(() => {
 +
let temp_c1 = document.getElementById("system_music").volume;
 +
temp_c1 -= temp.c1;
 +
if(temp_c1 <= 0)
 +
{
 +
temp_c1 = 0;
 +
fun_timer_clear("music");
 +
audio_stop("music");
 +
}
 +
document.getElementById("system_music").volume = temp_c1;
 +
}, 33);
 +
}
 +
else
 +
{
 +
audio_stop("music");
 
}
 
}
 
break;
 
break;
第572行: 第3,012行:
 
else if(data_command[3] != undefined)
 
else if(data_command[3] != undefined)
 
{
 
{
switch(data_command[3])
+
switch(data_command[3].toLowerCase())
 
{
 
{
case 'Dialog':
+
case 'background':
document.getElementById("txt_main").innerHTML = "";
+
temp.o1 = document.getElementById("pic_back");
 +
fun_timer_clear("back");
 +
if(temp.o1.lastElementChild == undefined){return -1;}
 +
temp.o1.lastElementChild.style.animation = "fade-out 0.3s 1"
 +
setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, 285);
 +
fun_delay("block",0.3);
 +
return 2;
 +
case 'character':
 +
temp.o1 = document.getElementById("pic_char");
 +
temp.c1 = temp.o1.childElementCount;
 +
for(let num = 0;num < temp.c1;num++)
 +
{
 +
if(temp.o1.childNodes[num].nodeType != 1)
 +
{
 +
continue;
 +
}
 +
temp.o1.childNodes[num].style.animation = "fade-out 0.2s 1";
 +
}
 +
setTimeout(() => {
 +
temp.o1.innerHTML = "";
 +
}, 190);
 +
fun_delay("block",0.2);
 +
return 2;
 +
case 'dialog':
 +
document.getElementById("txt_name").innerHTML = "";
 
document.getElementById("txt_output").innerHTML = "";
 
document.getElementById("txt_output").innerHTML = "";
 +
document.getElementById("system_dialog").style.display = "none";
 
break;
 
break;
case 'Background':
+
case 'image':
document.getElementById("pic_back").style.display = "none";
+
temp.o1 = document.getElementById("pic_image");
break;
+
fun_timer_clear("image");
case 'Image':
+
if(temp.o1.lastElementChild == undefined){return -1;}
document.getElementById("pic_image").style.display = "none";
+
temp.o1.lastElementChild.style.animation = "fade-out 0.3s 1"
break;
+
setTimeout(() => {
case 'Character':
+
temp.o1.innerHTML = "";
document.getElementById("pic_char_1").style.display = "none";
+
}, 285);
document.getElementById("pic_char_2").style.display = "none";
+
fun_delay("block",0.3);
 +
return 2;
 +
case 'predicate':
 +
decision_mode = false;
 
break;
 
break;
 +
case 'hideitem':
 +
temp.o1 = document.getElementById("pic_item").lastElementChild;
 +
if(temp.o1 == undefined){return -1;}
 +
temp.o1.style.animation = "fade-out 0.32s 1";
 +
setTimeout(() => {
 +
temp.o1.remove();
 +
}, 304);
 +
fun_delay("block",0.32);
 +
return 2;
 
}
 
}
 
return 1;
 
return 1;
第593行: 第3,072行:
 
else if(data_command[4] != undefined)
 
else if(data_command[4] != undefined)
 
{
 
{
document.getElementById("txt_name").innerHTML = data_command[4].replace(/(^[^"]+)"([^"]*)"/,"$2");
+
temp.d1 = data_command[4].toLowerCase();
now_txt = data_command[5];
+
if(temp.d1.search("delay") == 0)
 +
{
 +
temp.c1 = temp.d1.lastIndexOf("=")
 +
temp.c1 = temp.d1.substr(temp.c1+1)
 +
fun_delay("block",temp.c1);
 +
return 2;
 +
}
 +
temp.e1 = document.createElement("li");
 +
temp.d1 = data_command[4].replace(/(^[^"]+)"([^"]*)"/,"$2");
 +
now_txt = data_command[5].replace(/{@[Nn]ickname}/g,data_nickname);
 +
temp.d2 = now_txt.replace(/\<(.*?)\>/g,"")
 +
now_txt = now_txt.replace("<color=","<font color=");
 +
now_txt = now_txt.replace("</color>","</font>");
 +
if(fun_cal_len(temp.d1) > 12 || fun_cal_len(temp.d2) > 83)
 +
{
 +
temp.e1.style = "height:44px";
 +
}
 +
if(temp.d1 == ""){temp.d1 = "&nbsp;"}
 +
temp.e1.innerHTML = "<em>" + temp.d1 + "</em><span>" + now_txt + "</span>"
 +
document.getElementById("txt_name").innerHTML = temp.d1
 +
document.getElementById("playback_result").append(temp.e1)
 +
document.getElementById("system_dialog").style.display = "block";
 
}
 
}
 
return 0;
 
return 0;
 +
}
 +
function data_exist(key_path)
 +
{
 +
for (let num=0;num<data_need.length;num++)
 +
{
 +
if(data_need[num] == key_path)
 +
{
 +
return true;
 +
}
 +
}
 +
return false;
 +
}
 +
function data_override_check(mode,key_word,key_line)
 +
{
 +
let ret = false;
 +
key_line++;
 +
switch(mode)
 +
{
 +
case 'char':
 +
if(data_override.char[key_word] != undefined)
 +
{
 +
ret = true;
 +
if(data_override.char[key_word].limit == 'true')
 +
{
 +
if(data_override.char[key_word].title != undefined && data_override.char[key_word].title != txt_page_name)
 +
{
 +
ret = false;
 +
}
 +
if(data_override.char[key_word].line != undefined)
 +
{
 +
for(let temp_s1 of data_override.char[key_word].line.split("."))
 +
{
 +
if(temp_s1 == key_line)
 +
{
 +
ret = false;
 +
break;
 +
}
 +
}
 +
}
 +
}
 +
}
 +
break;
 +
case 'image':
 +
if(data_override.image[key_word] != undefined && data_override.image[key_word]["L" + key_line] != undefined)
 +
{
 +
ret = true;
 +
}
 +
break;
 +
case 'override':
 +
if(data_override.override[key_word] != undefined && data_override.override[key_word]["L" + key_line] != undefined)
 +
{
 +
ret = true;
 +
}
 +
break;
 +
case 'tween':
 +
if(data_override.tween[key_word] != undefined && data_override.tween[key_word]["L" + key_line] != undefined)
 +
{
 +
ret = true;
 +
}
 +
break;
 +
}
 +
return ret;
 
}
 
}
 
</script>
 
</script>
 
</includeonly>
 
</includeonly>

2020年5月24日 (日) 23:50的最新版本

提示
如果您需要了解这个小部件的更新日志,请查看剧情模拟器更新日志
提示
如果您需要了解这个小部件的更新日志,请查看剧情模拟器更新日志

自动▶
重置▶
剧情模拟器
单击开始剧情回顾