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

来自PRTS
跳转至: 导航搜索
第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 class="pic_style" id="pic_back" style="display:none;" onclick="txt_click(1)"></div>
+
  <div id="pic_back" style="display:block;width:800px;height:450px;" onclick="txt_click(0)"></div>
<div class="pic_style" id="pic_image" style="display:none;" onclick="txt_click(2)"></div>
+
  <div class="char_style" id="pic_char_1" style="display:none;" onclick="txt_click(1)">
  <div class="char_style" id="pic_char_1" style="display:none;" onclick="txt_click(11)">
 
 
  <div id="pic_char" style="float:left;position:absolute;left:200px;top:25px;width:400px;height:400px;"></div></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_2" style="display:none;" onclick="txt_click(12)">
+
  <div class="char_style" id="pic_char_2" style="display:none;" onclick="txt_click(2)">
 
  <div id="pic_char_left" style="float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;"></div>
 
  <div id="pic_char_left" style="float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;"></div>
 
  <div id="pic_char_right" style="float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;"></div></div>
 
  <div id="pic_char_right" style="float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;"></div></div>
  <div class="dialog_style" id="dialog_main" style="display:block;" onclick="txt_click()">
+
  <div id="dialog_main" style="position:absolute;width:790px;right:5px; bottom:5px;background-color:rgba(0,0,0,.8);" 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>
第29行: 第28行:
 
<style>
 
<style>
 
.char_style{
 
.char_style{
z-index:2;
 
 
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;
第46行: 第40行:
 
padding:0px 5px;
 
padding:0px 5px;
 
text-align:left;
 
text-align:left;
}
 
.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);
 
 
}
 
}
 
</style>
 
</style>
第67行: 第48行:
 
//(window.RLQ = window.RLQ || []).push(function () {
 
//(window.RLQ = window.RLQ || []).push(function () {
 
//$(document).ready(function() {
 
//$(document).ready(function() {
var txt_now = 0,txt_num = 0,txt_num_max = 0,now_txt = "";
+
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;
第79行: 第60行:
 
try  
 
try  
 
{
 
{
if(debug == true)
+
data_temp = document.getElementById("datas_txt").innerHTML;
{
 
data_temp = document.getElementById("datas_txt_temp").innerHTML;
 
}
 
else
 
{
 
data_temp = document.getElementById("datas_txt").innerHTML;
 
}
 
 
data_txt = data_temp.split("\n");
 
data_txt = data_temp.split("\n");
 
}
 
}
第153行: 第127行:
 
system_enabled = false;
 
system_enabled = false;
 
reset_enabled = true;
 
reset_enabled = true;
document.getElementById("button_reset").style.color = "";
+
document.getElementById("button_reset").style = "right:0px;"
 
if(flag_auto == true)
 
if(flag_auto == true)
 
{
 
{
第189行: 第163行:
 
auto_stop();
 
auto_stop();
 
}
 
}
document.getElementById("pic_back").style.display = "none";
+
document.getElementById("pic_back").innerHTML = "";
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 = "剧情模拟已结束,单击将重新开始剧情回顾";
 
system_enabled = true;
 
system_enabled = true;
 
reset_enabled = false;
 
reset_enabled = false;
document.getElementById("button_reset").style.color = "#808080";
+
document.getElementById("button_reset").style = "right:0px;color:#808080;"
 
txt_now = 0;
 
txt_now = 0;
 
txt_num_max = 0;
 
txt_num_max = 0;
 
return;
 
return;
 +
}
 +
else if(data_txt[txt_now].indexOf(":") > 0)
 +
{
 +
place = data_txt[txt_now].indexOf(":");
 +
// console.log(data_txt[txt_now].substr(0,place));
 +
document.getElementById("txt_name").innerHTML = data_txt[txt_now].substr(0,place);
 +
txt_num = place + 1;
 
}
 
}
 
//check
 
//check
第209行: 第190行:
 
else if (debug == false)
 
else if (debug == false)
 
{
 
{
if (data_txt[txt_now] = "")
 
{
 
console.log("Has skipped the space part.Data number:" + txt_now);
 
txt_now++;
 
txt_next();
 
return;
 
}
 
 
ret = txt_check();
 
ret = txt_check();
 
}
 
}
if(ret == -2)
+
if(ret == 1)
{
 
console.log("Break and wait timer.");
 
return;
 
}
 
else if(ret == -1)
 
{
 
console.log("Has skipped the unused part.Data number:" + txt_now);
 
txt_now++;
 
txt_next();
 
return;
 
}
 
else if(ret == 1)
 
 
{
 
{
 
txt_now++;
 
txt_now++;
 
txt_next();
 
txt_next();
return;
 
 
}
 
}
if(txt_now < txt_max && txt_now >= 0)
+
else if(txt_now < txt_max && txt_now >= 0)
 
{
 
{
 
txt_dynamic(50);
 
txt_dynamic(50);
第244行: 第205行:
 
{
 
{
 
var place = 0,temp = "";
 
var place = 0,temp = "";
if(data_txt[txt_now].indexOf(":") > 0)
 
{
 
place = data_txt[txt_now].indexOf(":");
 
document.getElementById("txt_name").innerHTML = data_txt[txt_now].substr(0,place);
 
txt_num = place + 1;
 
return 0;
 
}
 
 
if(data_txt[txt_now].startsWith("[clear]"))
 
if(data_txt[txt_now].startsWith("[clear]"))
 
{
 
{
document.getElementById("pic_back").style.display = "none";
+
document.getElementById("pic_back").innerHTML = "";
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_now].startsWith("[clear_back]"))
 
{
 
{
document.getElementById("pic_back").style.display = "none";
+
document.getElementById("pic_back").innerHTML = "";
 
return 1;
 
return 1;
 
}
 
}
 
else if(data_txt[txt_now].startsWith("[clear_char]"))
 
else if(data_txt[txt_now].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;
 
}
 
}
第274行: 第228行:
 
temp = data_txt[txt_now].substr(place);
 
temp = data_txt[txt_now].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;
 
}
 
}
第282行: 第235行:
 
temp = data_txt[txt_now].substr(place);
 
temp = data_txt[txt_now].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;
 
}
 
}
第297行: 第250行:
 
{
 
{
 
console.error("Command analyze failed.");
 
console.error("Command analyze failed.");
return -1;
+
return;
 
}
 
}
 
pic_left=temp[0];
 
pic_left=temp[0];
第305行: 第258行:
 
if (data_txt[txt_now].startsWith("[char_left]"))
 
if (data_txt[txt_now].startsWith("[char_left]"))
 
{
 
{
char_left.style.display = "block";
+
char_left.style = "float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;";
char_right.style.display = "none";
+
char_right.style = "display:none;";
 
}
 
}
 
else if (data_txt[txt_now].startsWith("[char_right]"))
 
else if (data_txt[txt_now].startsWith("[char_right]"))
 
{
 
{
char_right.style.display = "block";
+
char_right.style = "float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;";
char_left.style.display = "none";
+
char_left.style = "display:none;";
 
}
 
}
 
else if (data_txt[txt_now].startsWith("[char_both]"))
 
else if (data_txt[txt_now].startsWith("[char_both]"))
 
{
 
{
char_left.style.display = "block";
+
char_left.style = "float:left;position:absolute;left:100px;top:25px;width:400px;height:400px;";
char_right.style.display = "block";
+
char_right.style = "float:right;position:absolute;right:100px;top:25px;width:400px;height:400px;";
 
}
 
}
document.getElementById("pic_char_1").style.display = "block";
+
document.getElementById("pic_char_1").style = "display:none;";
document.getElementById("pic_char_2").style.display = "block";
+
document.getElementById("pic_char_2").style = "display:block;";
 
return 1;
 
return 1;
 
}
 
}
第331行: 第284行:
 
}
 
}
 
reset_enabled = true;
 
reset_enabled = true;
document.getElementById("button_reset").style.color = "";
+
document.getElementById("button_reset").style = "right:0px;"
 
if(flag_auto == false)
 
if(flag_auto == false)
 
{
 
{
第366行: 第319行:
 
txt_stop();
 
txt_stop();
 
}
 
}
document.getElementById("pic_back").style.display = "none";
+
document.getElementById("pic_back").innerHTML = "";
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 = "剧情模拟已重置,单击开始剧情回顾";
 
reset_enabled = false;
 
reset_enabled = false;
document.getElementById("button_reset").style.color = "#808080"
+
document.getElementById("button_reset").style = "right:0px;color:#808080;"
 
txt_now = 0;
 
txt_now = 0;
 
txt_num_max = 0;
 
txt_num_max = 0;
第415行: 第368行:
 
function txt_dynamic(interval)
 
function txt_dynamic(interval)
 
{
 
{
if (debug == true)
+
txt_num_max = data_txt[txt_now].length;
{
 
txt_num_max = now_txt.length;
 
}
 
else
 
{
 
txt_num_max = data_txt[txt_now].length;
 
}
 
 
flag_timer = true;
 
flag_timer = true;
 
timer_id = setInterval("timer1()",50);
 
timer_id = setInterval("timer1()",50);
第430行: 第376行:
 
if (txt_num < txt_num_max)
 
if (txt_num < txt_num_max)
 
{
 
{
if (debug == true)
+
txt_temp = txt_temp + data_txt[txt_now].substr(txt_num,1);
{
 
txt_temp = txt_temp + now_txt[txt_now].substr(txt_num,1);
 
}
 
else
 
{
 
txt_temp = txt_temp + data_txt[txt_now].substr(txt_num,1);
 
}
 
 
document.getElementById("txt_output").innerHTML = txt_temp;
 
document.getElementById("txt_output").innerHTML = txt_temp;
 
txt_num++;
 
txt_num++;
第460行: 第399行:
 
}
 
}
 
var data_command = data_txt[txt_now].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
 
var data_command = data_txt[txt_now].match("^\\[\\s*(?:(.*)\\((.*)\\)|(?:([\\.|\\w]*)|(.*)))\\s*\\]\\s*(.*)"); //COMMAND REGEX
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_image = document.getElementById("pic_image");
 
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=\"800\" height=\"450\" src=\"" + data_pic_back[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.display = "block";
 
char_right.style.display = "block";
 
}
 
else if (command_set.focus == 1)
 
{
 
char_left.style.display = "block";
 
char_right.style.display = "none";
 
}
 
else if(command_set.focus ==2)
 
{
 
char_left.style.display = "none";
 
char_right.style.display = "block";
 
}
 
obj_char_1.style.display = "none";
 
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] + "\">";
 
char_right.innerHTML = "<img alt=\"" + command_set.name2 + "\" width=\"800\" height=\"450\" src=\"" + data_pic_back[command_set.name2] + "\">";
 
}
 
break;
 
default:
 
return -1;
 
}
 
return 1;
 
}
 
else if(data_command[3] != undefined)
 
{
 
switch(data_command[3])
 
{
 
case 'Dialog':
 
document.getElementById("txt_main").innerHTML = "";
 
document.getElementById("txt_output").innerHTML = "";
 
break;
 
case 'Background':
 
document.getElementById("pic_back").style.display = "none";
 
break;
 
case 'Image':
 
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];
 
}
 
 
return 0;
 
return 0;
 
}
 
}
 
</script>
 
</script>
 
</includeonly>
 
</includeonly>

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

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