Typing effect: display all on click

This commit is contained in:
ckcz123 2018-09-17 19:35:34 +08:00
parent bc5d4efcf7
commit c57e734b97
5 changed files with 23 additions and 6 deletions

View File

@ -211,7 +211,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"pushBox"
]
},
"_data": "图块的默认触发器"
"_data": "图块的默认触发器"
},
"noPass": {
"_leaf": true,
@ -223,7 +223,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
false
]
},
"_data": "图块默认可通行状态"
"_data": "该图块是否不可通行true代表不可通行false代表可通行null代表使用系统缺省值"
}
}
},

View File

@ -808,6 +808,12 @@ actions.prototype.keyUpConfirmBox = function (keycode) {
actions.prototype.clickAction = function (x,y) {
if (core.status.event.data.type=='text') {
// 打字机效果显示全部文字
if (core.status.event.interval!=null) {
core.insertAction({"type": "text", "text": core.status.event.ui, "showAll": true});
}
// 文字
core.doAction();
return;
@ -859,6 +865,10 @@ actions.prototype.keyDownAction = function (keycode) {
////// 自定义事件时,放开某个键的操作 //////
actions.prototype.keyUpAction = function (keycode) {
if (core.status.event.data.type=='text' && (keycode==13 || keycode==32 || keycode==67)) {
// 打字机效果显示全部文字
if (core.status.event.interval!=null) {
core.insertAction({"type": "text", "text": core.status.event.ui, "showAll": true});
}
core.doAction();
return;
}

View File

@ -280,6 +280,7 @@ events.prototype.doAction = function() {
// 清空boxAnimate和UI层
core.status.boxAnimateObjs = [];
clearInterval(core.status.event.interval);
core.status.event.interval = null;
core.clearMap('ui');
core.setAlpha('ui', 1.0);
@ -328,7 +329,7 @@ events.prototype.doAction = function() {
if (core.status.replay.replaying)
core.events.doAction();
else
core.ui.drawTextBox(data.text);
core.ui.drawTextBox(data.text, data.showAll);
break;
case "autoText":
if (core.status.replay.replaying)

View File

@ -74,7 +74,7 @@ maps.prototype.addInfo = function (block) {
block.event.trigger = 'getItem';
}
if (!core.isset(block.event.noPass)) {
if (block.event.cls.indexOf("enemy")==0 || block.event.cls.indexOf("npc")==0 || block.event.cls=='terrains') {
if (block.event.cls.indexOf("enemy")==0 || block.event.cls.indexOf("npc")==0 || block.event.cls=='terrains' || block.event.cls=='autotile') {
block.event.noPass = true;
}
}

View File

@ -282,9 +282,14 @@ ui.prototype.drawText = function (contents, callback) {
}
////// 绘制一个对话框 //////
ui.prototype.drawTextBox = function(content) {
ui.prototype.drawTextBox = function(content, showAll) {
if (core.isset(core.status.event) && core.status.event.id=='action') {
core.status.event.ui = content;
}
clearInterval(core.status.event.interval);
core.status.event.interval = null;
// 获得name, image, icon
var id=null, name=null, image=null, icon=null, iconHeight=32, animate=null;
@ -541,7 +546,7 @@ ui.prototype.drawTextBox = function(content) {
}
if (textAttribute.time<=0 || core.status.event.id!='action') {
if (showAll || textAttribute.time<=0 || core.status.event.id!='action') {
drawContent(content);
}
else {
@ -550,6 +555,7 @@ ui.prototype.drawTextBox = function(content) {
drawContent(content.substring(0, ++index));
if (index==content.length) {
clearInterval(core.status.event.interval);
core.status.event.interval = null;
}
}, textAttribute.time);
}