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

来自PRTS
跳转至: 导航搜索
第1行: 第1行:
<noinclude>{{#Widget:Krliov/test2|pic_back={{用户:Krliov/testpage3}}|pic_char={{用户:Krliov/testpage4}}|datas=
+
<noinclude>{{#Widget:Krliov/test2|datas_txt={{用户:Krliov/testpage2}}|pic_back={{用户:Krliov/testpage3}}|pic_char={{用户:Krliov/testpage4}}|datas=
 
[back]bg_cher_1
 
[back]bg_cher_1
 
[char]char_130_doberm_ex
 
[char]char_130_doberm_ex
第15行: 第15行:
 
  <div class="button_style" id="button_auto" style="right:100px;" onclick="txt_auto()">自动▶</div>
 
  <div class="button_style" id="button_auto" style="right:100px;" onclick="txt_auto()">自动▶</div>
 
  <div class="button_style" id="button_reset" style="right:0px;color:#808080;" onclick="txt_reset()">重置▶</div>
 
  <div class="button_style" id="button_reset" style="right:0px;color:#808080;" onclick="txt_reset()">重置▶</div>
  <div id="pic_back" style="display:block;width:800px;height:450px;" onclick="txt_click(0)"></div>
+
  <div class="pic_style" id="pic_back" style="display:none;" onclick="txt_click(1)"></div>
  <div class="char_style" id="pic_char_1" style="display:none;" onclick="txt_click(1)">
+
<div class="pic_style" id="pic_image" style="display:none;" onclick="txt_click(2)"></div>
  <div id="pic_char" style="float:left;position:absolute;left:200px;top:25px;width:400px;height:400px;"></div></div>
+
  <div class="char_style" id="pic_char_1" style="display:none;" onclick="txt_click(11)">
  <div class="char_style" id="pic_char_2" style="display:none;" onclick="txt_click(2)">
+
  <div id="pic_char" style="float:left;position:absolute;left:200px;top:25px;"></div></div>
  <div id="pic_char_left" style="float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;"></div>
+
  <div class="char_style" id="pic_char_2" style="display:none;" onclick="txt_click(12)">
  <div id="pic_char_right" style="float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;"></div></div>
+
  <div id="pic_char_left" style="float:left;position:absolute;left:100px;top:25px;"></div>
  <div id="dialog_main" style="position:absolute;width:790px;right:5px; bottom:5px;background-color:rgba(0,0,0,.8);" onclick="txt_click()">
+
  <div id="pic_char_right" style="float:right;position:absolute;right:100px;top:25px;"></div></div>
 +
  <div class="dialog_style" id="dialog_main" 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 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 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 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>
第28行: 第29行:
 
<style>
 
<style>
 
.char_style{
 
.char_style{
 +
z-index:2;
 +
width:400px;
 +
height:400px;
 
background-clip:"padding-box";
 
background-clip:"padding-box";
 +
}
 +
#pic_image{
 +
z-index:2;
 
}
 
}
 
.button_style{
 
.button_style{
 +
z-index:2;
 
position:absolute;
 
position:absolute;
 
float:right;
 
float:right;
第40行: 第48行:
 
padding:0px 5px;
 
padding:0px 5px;
 
text-align:left;
 
text-align:left;
 +
cursor:default;
 +
}
 +
.pic_style{
 +
z-index:1;
 +
width:800px;
 +
height:450px;
 +
}
 +
.dialog_style{
 +
z-index:2;
 +
position:absolute;
 +
width:790px;
 +
right:5px;
 +
bottom:5px;
 +
background-color:rgba(0,0,0,.8);
 +
cursor:default;
 
}
 
}
 
</style>
 
</style>
 +
<script type="csv" id="datas_txt_temp"><!--{$datas_txt}--></script>
 
<script type="csv" id="datas_txt"><!--{$datas}--></script>
 
<script type="csv" id="datas_txt"><!--{$datas}--></script>
 
<script type="csv" id="datas_back"><!--{$pic_back}--></script>
 
<script type="csv" id="datas_back"><!--{$pic_back}--></script>
 
<script type="csv" id="datas_char"><!--{$pic_char}--></script>
 
<script type="csv" id="datas_char"><!--{$pic_char}--></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 txt_now = 0,txt_num = 0,txt_num_max = 0;
 
 
var timer_id,flag_timer = false;
 
var timer_id,flag_timer = false;
 
var timer_id_auto,timer_id_wait,flag_auto = false;
 
var timer_id_auto,timer_id_wait,flag_auto = false;
 
var reset_enabled = false,auto_enabled = true,click_enabled = true,system_enabled = true;
 
var reset_enabled = false,auto_enabled = true,click_enabled = true,system_enabled = true;
 
var auto_num = 0;
 
var auto_num = 0;
var txt_temp = "";
 
 
var data_temp = "";
 
var data_temp = "";
 
var data_txt = {};
 
var data_txt = {};
 +
var data_txt_test = {};
 
var data_pic_back = {};
 
var data_pic_back = {};
 
var data_pic_char = {};
 
var data_pic_char = {};
 
try  
 
try  
 
{
 
{
 +
data_temp = document.getElementById("datas_txt_temp").innerHTML;
 +
data_txt_test = data_temp.split("\n");
 
data_temp = document.getElementById("datas_txt").innerHTML;
 
data_temp = document.getElementById("datas_txt").innerHTML;
 
data_txt = data_temp.split("\n");
 
data_txt = data_temp.split("\n");
第65行: 第89行:
 
catch(err)
 
catch(err)
 
{
 
{
 +
var data_txt = new Array();
 
console.error("ERROR:The datas 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("Krliov:There has something wrong when loaded datas,please check the input. :3");
 
data_txt.push("Krliov:There has something wrong when loaded datas,please check the input. :3");
 
auto_enabled = false;
 
auto_enabled = false;
 +
click_enabled = false;
 
system_enabled = false;
 
system_enabled = false;
 
}
 
}
var txt_max = data_txt.length;
 
 
try
 
try
 
{
 
{
第82行: 第107行:
 
catch(err)
 
catch(err)
 
{
 
{
 +
var data_txt = new Array();
 
console.error("ERROR:The pic_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("Krliov:There has something wrong when loaded pic_back,please check the input. :3");
 
data_txt.push("Krliov:There has something wrong when loaded pic_back,please check the input. :3");
 
auto_enabled = false;
 
auto_enabled = false;
 +
click_enabled = false;
 
system_enabled = false;
 
system_enabled = false;
 
}
 
}
第98行: 第125行:
 
catch(err)
 
catch(err)
 
{
 
{
 +
var data_txt = new Array();
 
console.error("ERROR:The pic_char loaded failed,please check the input and try again.");
 
console.error("ERROR:The pic_char loaded failed,please check the input and try again.");
 
data_txt.push("Krliov:There has something wrong when loaded pic_char,please check the input. :3");
 
data_txt.push("Krliov:There has something wrong when loaded pic_char,please check the input. :3");
 
auto_enabled = false;
 
auto_enabled = false;
 +
click_enabled = false;
 
system_enabled = false;
 
system_enabled = false;
 
}
 
}
 
console.log(data_txt);
 
console.log(data_txt);
 +
console.log(data_txt_test);
 
console.log(data_pic_back);
 
console.log(data_pic_back);
 
console.log(data_pic_char);
 
console.log(data_pic_char);
//})
 
//});
 
 
function txt_start()
 
function txt_start()
 
{
 
{
 
if (system_enabled == false)
 
if (system_enabled == false)
 
{
 
{
// console.log("system didn't passed.");
+
console.log("system didn't passed.");
 
return;
 
return;
 
}
 
}
// console.log("system passed.");
+
console.log("system passed.");
 
txt_click(-1);
 
txt_click(-1);
 
}
 
}
 
function txt_click(enter_id)
 
function txt_click(enter_id)
 
{
 
{
if(click_enabled == false)
+
if(click_enabled == false && enter_id == undefined)
 +
{
 +
console.log("Has disregard the default settings.");
 +
}
 +
else if(click_enabled == false)
 
{
 
{
 
return;
 
return;
 
}
 
}
// console.log("id=" + enter_id);
+
else if(system_enabled == true)
system_enabled = false;
+
{
reset_enabled = true;
+
if (mw.config.values.debug == true)
document.getElementById("button_reset").style = "right:0px;"
+
{
 +
txt_max = data_txt_test.length;
 +
}
 +
else
 +
{
 +
txt_max = data_txt.length;
 +
}
 +
console.log("txt_max=" + txt_max);
 +
system_enabled = false;
 +
reset_enabled = true;
 +
document.getElementById("button_reset").style.color = "";
 +
}
 +
console.log("enter_id=" + enter_id);
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
第136行: 第180行:
 
// console.log("The timer has been stopped force.");
 
// console.log("The timer has been stopped force.");
 
txt_stop();
 
txt_stop();
txt_now--;
+
document.getElementById("txt_output").innerHTML = now_txt;
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;
 
}
 
}
第157行: 第189行:
 
var place = -1;
 
var place = -1;
 
//before
 
//before
if (txt_now == txt_max)
+
if (txt_num == txt_max)
 
{
 
{
 +
console.log("txt_num=" + txt_num + " ,txt_max=" + txt_max)
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
 
auto_stop();
 
auto_stop();
 
}
 
}
document.getElementById("pic_back").innerHTML = "";
+
document.getElementById("pic_back").style.display = "none";
document.getElementById("pic_char_1").style = "display:none;";
+
document.getElementById("pic_char_1").style.display = "none";
document.getElementById("pic_char_2").style = "display:none;";
+
document.getElementById("pic_char_2").style.display = "none";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已结束,单击将重新开始剧情回顾";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已结束,单击将重新开始剧情回顾";
 +
document.getElementById("dialog_main").style.display = "block";
 
system_enabled = true;
 
system_enabled = true;
 
reset_enabled = false;
 
reset_enabled = false;
document.getElementById("button_reset").style = "right:0px;color:#808080;"
+
document.getElementById("button_reset").style.color = "#808080";
txt_now = 0;
+
txt_num = 0;
txt_num_max = 0;
+
now_txt_max = 0;
 
return;
 
return;
 
}
 
}
else if(data_txt[txt_now].indexOf(":") > 0)
+
//check
 +
var ret = 0;
 +
if (mw.config.values.debug == true)
 
{
 
{
place = data_txt[txt_now].indexOf(":");
+
if (data_txt_test[txt_num] == "")
// console.log(data_txt[txt_now].substr(0,place));
+
{
document.getElementById("txt_name").innerHTML = data_txt[txt_now].substr(0,place);
+
ret = -3;
txt_num = place + 1;
+
}
 +
else
 +
{
 +
ret = txt_check_test();
 +
}
 
}
 
}
//check
+
else
var ret = 0;
+
{
if (debug == true)
+
if (data_txt[txt_num] == "")
 +
{
 +
ret = -3;
 +
}
 +
else
 +
{
 +
ret = txt_check();
 +
}
 +
}
 +
if(ret == -3)
 +
{
 +
console.log("Has skipped the space part.Data number:" + txt_num);
 +
txt_num++;
 +
txt_next();
 +
return;
 +
}
 +
else if(ret == -2)
 
{
 
{
ret = txt_check_test();
+
console.log("Break and wait timer.");
 +
txt_num++;
 +
return;
 
}
 
}
else if (debug == false)
+
else if(ret == -1)
 
{
 
{
ret = txt_check();
+
console.log("Has skipped the unused part.Data number:" + txt_num);
 +
txt_num++;
 +
txt_next();
 +
return;
 
}
 
}
if(ret == 1)
+
else if(ret == 1)
 
{
 
{
txt_now++;
+
console.log("Data analyze complete.Data number:" + txt_num);
 +
txt_num++;
 
txt_next();
 
txt_next();
 +
return;
 
}
 
}
else if(txt_now < txt_max && txt_now >= 0)
+
console.log("Data number:" + txt_num);
 +
if(txt_num < txt_max && txt_num >= 0)
 
{
 
{
 
txt_dynamic(50);
 
txt_dynamic(50);
第205行: 第269行:
 
{
 
{
 
var place = 0,temp = "";
 
var place = 0,temp = "";
if(data_txt[txt_now].startsWith("[clear]"))
+
if(data_txt[txt_num].indexOf(":") > 0)
 +
{
 +
place = data_txt[txt_num].indexOf(":");
 +
document.getElementById("txt_name").innerHTML = data_txt[txt_num].substr(0,place);
 +
now_txt = data_txt[txt_num].substr(place + 1);
 +
console.log("now_txt=" +  now_txt);
 +
return 0;
 +
}
 +
if(data_txt[txt_num].startsWith("[clear]"))
 
{
 
{
document.getElementById("pic_back").innerHTML = "";
+
document.getElementById("pic_back").style.display = "none";
document.getElementById("pic_char_1").style = "display:none;";
+
document.getElementById("pic_char_1").style.display = "none";
document.getElementById("pic_char_2").style = "display:none;";
+
document.getElementById("pic_char_2").style.display = "none";
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[clear_back]"))
+
else if(data_txt[txt_num].startsWith("[clear_back]"))
 
{
 
{
document.getElementById("pic_back").innerHTML = "";
+
document.getElementById("pic_back").style.display = "none";
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[clear_char]"))
+
else if(data_txt[txt_num].startsWith("[clear_char]"))
 
{
 
{
document.getElementById("pic_char_1").style = "display:none;";
+
document.getElementById("pic_char_1").style.display = "none";
document.getElementById("pic_char_2").style = "display:none;";
+
document.getElementById("pic_char_2").style.display = "none";
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[back]"))
+
else if(data_txt[txt_num].startsWith("[back]"))
 
{
 
{
place = data_txt[txt_now].indexOf("]") + 1;
+
place = data_txt[txt_num].indexOf("]") + 1;
temp = data_txt[txt_now].substr(place);
+
temp = data_txt[txt_num].substr(place);
 
document.getElementById("pic_back").innerHTML = "<img alt=\"" + temp + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[temp] + "\">";
 
document.getElementById("pic_back").innerHTML = "<img alt=\"" + temp + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[temp] + "\">";
 +
document.getElementById("pic_back").style.display = "block";
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[char]"))
+
else if(data_txt[txt_num].startsWith("[char]"))
 
{
 
{
place = data_txt[txt_now].indexOf("]") + 1;
+
place = data_txt[txt_num].indexOf("]") + 1;
temp = data_txt[txt_now].substr(place);
+
temp = data_txt[txt_num].substr(place);
 
document.getElementById("pic_char").innerHTML = "<img alt=\"" + temp + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[temp] + "\">";
 
document.getElementById("pic_char").innerHTML = "<img alt=\"" + temp + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[temp] + "\">";
document.getElementById("pic_char_1").style = "display:block;";
+
document.getElementById("pic_char_1").style.display = "block";
document.getElementById("pic_char_2").style = "display:none;";
+
document.getElementById("pic_char_2").style.display = "none";
 
return 1;
 
return 1;
 
}
 
}
else if(data_txt[txt_now].startsWith("[char_"))
+
else if(data_txt[txt_num].startsWith("[char_"))
 
{
 
{
 
var pic_left = "",pic_right = "";
 
var pic_left = "",pic_right = "";
 
var char_left = document.getElementById("pic_char_left");
 
var char_left = document.getElementById("pic_char_left");
 
var char_right = document.getElementById("pic_char_right");
 
var char_right = document.getElementById("pic_char_right");
place = data_txt[txt_now].indexOf("]") + 1;
+
place = data_txt[txt_num].indexOf("]") + 1;
temp = data_txt[txt_now].substr(place);
+
temp = data_txt[txt_num].substr(place);
 
temp = temp.split(",");
 
temp = temp.split(",");
 
if(temp.length <= 1)
 
if(temp.length <= 1)
 
{
 
{
 
console.error("Command analyze failed.");
 
console.error("Command analyze failed.");
return;
+
return -1;
 
}
 
}
 
pic_left=temp[0];
 
pic_left=temp[0];
第256行: 第329行:
 
char_left.innerHTML = "<img alt=\"" + pic_left + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[pic_left] + "\">";
 
char_left.innerHTML = "<img alt=\"" + pic_left + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[pic_left] + "\">";
 
char_right.innerHTML = "<img alt=\"" + pic_right + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[pic_right] + "\">";
 
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]"))
+
if (data_txt[txt_num].startsWith("[char_left]"))
 
{
 
{
char_left.style = "float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;";
+
char_left.style.display = "block";
char_right.style = "display:none;";
+
char_right.style.display = "none";
 
}
 
}
else if (data_txt[txt_now].startsWith("[char_right]"))
+
else if (data_txt[txt_num].startsWith("[char_right]"))
 
{
 
{
char_right.style = "float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;";
+
char_right.style.display = "block";
char_left.style = "display:none;";
+
char_left.style.display = "none";
 
}
 
}
else if (data_txt[txt_now].startsWith("[char_both]"))
+
else if (data_txt[txt_num].startsWith("[char_both]"))
 
{
 
{
char_left.style = "float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;";
+
char_left.style.display = "block";
char_right.style = "float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;";
+
char_right.style.display = "block";
 
}
 
}
document.getElementById("pic_char_1").style = "display:none;";
+
document.getElementById("pic_char_1").style.display = "block";
document.getElementById("pic_char_2").style = "display:block;";
+
document.getElementById("pic_char_2").style.display = "block";
 
return 1;
 
return 1;
 
}
 
}
 +
now_txt = data_txt[txt_num];
 
return 0;
 
return 0;
 
}
 
}
第281行: 第355行:
 
if(auto_enabled == false)
 
if(auto_enabled == false)
 
{
 
{
 +
console.log("auto didn't passed.");
 
return;
 
return;
 
}
 
}
 +
console.log("auto passed.");
 
reset_enabled = true;
 
reset_enabled = true;
document.getElementById("button_reset").style = "right:0px;"
+
document.getElementById("button_reset").style.color = "";
 
if(flag_auto == false)
 
if(flag_auto == false)
 
{
 
{
if (system_enabled == true)
+
if(system_enabled == true)
{
+
{  
 +
if(mw.config.values.debug == true)
 +
{
 +
txt_max = data_txt_test.length;
 +
}
 +
else
 +
{
 +
txt_max = data_txt.length;
 +
}
 +
console.log("txt_max=" + txt_max);
 
system_enabled = false;
 
system_enabled = false;
 
}
 
}
第294行: 第379行:
 
timer_id_auto = setInterval("auto_dynamic()",400);
 
timer_id_auto = setInterval("auto_dynamic()",400);
 
flag_auto = true;
 
flag_auto = true;
timer_id_wait = setTimeout("txt_next()",txt_num_max*80+Math.min(txt_num_max,1)*1000);
+
timer_id_wait = setTimeout("txt_next()",now_txt_max*80+Math.min(now_txt_max,1)*1000);
 
}
 
}
 
else if(flag_auto == true)
 
else if(flag_auto == true)
第305行: 第390行:
 
if(reset_enabled == false)
 
if(reset_enabled == false)
 
{
 
{
system_enabled = true;
+
console.log("reset didn't passed.");
// console.log("reset didn't passed.");
 
 
return;
 
return;
 
}
 
}
 
system_enabled = false;
 
system_enabled = false;
// console.log("reset passed.");
+
console.log("reset passed.");
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
第319行: 第403行:
 
txt_stop();
 
txt_stop();
 
}
 
}
document.getElementById("pic_back").innerHTML = "";
+
document.getElementById("pic_back").style.display = "none";
document.getElementById("pic_char_1").style = "display:none;";
+
document.getElementById("pic_char_1").style.display = "none";
document.getElementById("pic_char_2").style = "display:none;";
+
document.getElementById("pic_char_2").style.display = "none";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
document.getElementById("txt_name").innerHTML = "剧情模拟器";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已重置,单击开始剧情回顾";
 
document.getElementById("txt_output").innerHTML = "剧情模拟已重置,单击开始剧情回顾";
 +
document.getElementById("dialog_main").style.display = "block";
 
reset_enabled = false;
 
reset_enabled = false;
document.getElementById("button_reset").style = "right:0px;color:#808080;"
+
system_enabled = true;
txt_now = 0;
+
document.getElementById("button_reset").style.color = "#808080"
txt_num_max = 0;
+
txt_num = 0;
 +
now_txt_max = 0;
 
return;
 
return;
 
}
 
}
第344行: 第430行:
 
clearInterval(timer_id);
 
clearInterval(timer_id);
 
flag_timer = false;
 
flag_timer = false;
txt_num = 0;
+
now_txt_num = 0;
txt_temp = "";
+
now_txt = "";
txt_now++;
+
now_txt_temp = "";
 +
txt_num++;
 
}
 
}
 
function auto_dynamic()
 
function auto_dynamic()
第368行: 第455行:
 
function txt_dynamic(interval)
 
function txt_dynamic(interval)
 
{
 
{
txt_num_max = data_txt[txt_now].length;
+
now_txt_max = now_txt.length;
 
flag_timer = true;
 
flag_timer = true;
 
timer_id = setInterval("timer1()",50);
 
timer_id = setInterval("timer1()",50);
第374行: 第461行:
 
function timer1()
 
function timer1()
 
{
 
{
if (txt_num < txt_num_max)
+
if (now_txt_num < now_txt_max)
 
{
 
{
txt_temp = txt_temp + data_txt[txt_now].substr(txt_num,1);
+
now_txt_temp = now_txt_temp + now_txt.substr(now_txt_num,1);
document.getElementById("txt_output").innerHTML = txt_temp;
+
document.getElementById("txt_output").innerHTML = now_txt_temp;
txt_num++;
+
now_txt_num++;
 
return;
 
return;
 
}
 
}
第385行: 第472行:
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
timer_id_wait = setTimeout("txt_next()",txt_num_max*80+1000)
+
timer_id_wait = setTimeout("txt_next()",now_txt_max*80+1000)
 
}
 
}
 
}
 
}
 
function txt_check_test()
 
function txt_check_test()
 
{
 
{
if(data_txt[txt_now].match("^\\s+$")) //ONLY SPACE REGEX
+
if(data_txt_test[txt_num].match("^\\s+$")) //ONLY SPACE REGEX
 
{
 
{
 
return -1;
 
return -1;
 
}
 
}
else if(data_txt[txt_now].match("^\\s*//.*$")) //COMMENT REGEX
+
else if(data_txt_test[txt_num].match("^\\s*//.*$")) //COMMENT REGEX
 
{
 
{
 
return -1;
 
return -1;
 
}
 
}
var data_command = data_txt[txt_now].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
+
var data_command = data_txt_test[txt_num].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
+
console.log(data_command);
 +
if (data_command[1] != undefined)
 +
{
 +
var command_set = {};
 +
data_command[2] = data_command[2].replace(/\s+|["$]|#[^\,]+/g,"");
 +
for (num of data_command[2].split(","))
 +
{
 +
var [type,value] = num.split("=");
 +
command_set[type] = value;
 +
}
 +
switch (data_command[1])
 +
{
 +
case 'HEADER':
 +
return -1;
 +
break;
 +
case 'PlayMusic':
 +
return -1;
 +
break;
 +
case 'StopMusic':
 +
return -1;
 +
break;
 +
case 'Delay':
 +
if (command_set.time == undefined)
 +
{
 +
return -1;
 +
}
 +
setTimeout("txt_next()",command_set.time*1000);
 +
return -2;
 +
break;
 +
case 'Blocker':
 +
return -1;
 +
break;
 +
case 'Decision':
 +
return -1;
 +
break;
 +
case 'Predicate':
 +
return -1;
 +
break;
 +
case 'Background':
 +
var obj_back = document.getElementById("pic_back");
 +
if(command_set.image == undefined)
 +
{
 +
obj_back.style.display = "none";
 +
break;
 +
}
 +
obj_back.innerHTML = "<img alt=\"" + command_set.image + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.image] + "\">";
 +
obj_back.style.display = "block";
 +
break;
 +
case 'Image':
 +
var obj_back = document.getElementById("pic_back");
 +
var obj_image = document.getElementById("pic_image");
 +
if(command_set.image == undefined)
 +
{
 +
obj_back.style.display = "block";
 +
obj_image.style.display = "none";
 +
break;
 +
}
 +
obj_back.style.display = "none";
 +
obj_image.innerHTML = "<img alt=\"" + command_set.image + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.image] + "\">";
 +
obj_image.style.display = "block";
 +
break;
 +
case 'ImageTween':
 +
return -1;
 +
break;
 +
case 'CameraShake':
 +
return -1;
 +
break;
 +
case 'Character':
 +
obj_char_1 = document.getElementById("pic_char_1");
 +
obj_char_2 = document.getElementById("pic_char_2");
 +
if (command_set.name == undefined)
 +
{
 +
obj_char_1.style.display = "none";
 +
obj_char_2.style.display = "none";
 +
}
 +
else if (command_set.name2 == undefined)
 +
{
 +
obj_char_1.style.display = "block";
 +
obj_char_2.style.display = "none";
 +
document.getElementById("pic_char").innerHTML = "<img alt=\"" + command_set.name + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[command_set.name] + "\">";
 +
}
 +
else
 +
{
 +
var char_left = document.getElementById("pic_char_left");
 +
var char_right = document.getElementById("pic_char_right");
 +
if (command_set.focus == undefined)
 +
{
 +
char_left.style.filter = "";
 +
char_right.style.filter = "";
 +
}
 +
else if (command_set.focus == 1)
 +
{
 +
char_left.style.filter = "";
 +
char_right.style.filter = "brightness(50%)";
 +
}
 +
else if(command_set.focus ==2)
 +
{
 +
char_left.style.filter = "brightness(50%)";
 +
char_right.style.filter = "";
 +
}
 +
obj_char_1.style.display = "none";
 +
obj_char_2.style.display = "block";
 +
char_left.innerHTML = "<img alt=\"" + command_set.name + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[command_set.name] + "\">";
 +
char_right.innerHTML = "<img alt=\"" + command_set.name2 + "\" width=\"400\" height=\"400\" src=\"" + data_pic_char[command_set.name2] + "\">";
 +
}
 +
break;
 +
default:
 +
return -1;
 +
}
 +
return 1;
 +
}
 +
else if(data_command[3] != undefined)
 +
{
 +
switch(data_command[3])
 +
{
 +
case 'Dialog':
 +
document.getElementById("dialog_main").style.display = "none";
 +
break;
 +
case 'Background':
 +
document.getElementById("pic_back").style.display = "none";
 +
break;
 +
case 'Image':
 +
document.getElementById("pic_back").style.display = "block";
 +
document.getElementById("pic_image").style.display = "none";
 +
break;
 +
case 'Character':
 +
document.getElementById("pic_char_1").style.display = "none";
 +
document.getElementById("pic_char_2").style.display = "none";
 +
break;
 +
}
 +
return 1;
 +
}
 +
else if(data_command[4] != undefined)
 +
{
 +
document.getElementById("txt_name").innerHTML = data_command[4].replace(/(^[^"]+)"([^"]*)"/,"$2");
 +
now_txt = data_command[5];
 +
document.getElementById("dialog_main").style.display = "block";
 +
}
 
return 0;
 
return 0;
 
}
 
}
 
</script>
 
</script>
 
</includeonly>
 
</includeonly>

2019年10月21日 (一) 20:33的版本

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