From e3e8546d03415ecc6cfc65d537f75cc10014beef Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 7 Aug 2021 23:32:09 +0800 Subject: [PATCH] Fix drawTextBox animation --- libs/actions.js | 13 ++++++++++--- libs/ui.js | 4 +--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/actions.js b/libs/actions.js index cf364da2..58b4c28f 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1024,10 +1024,14 @@ actions.prototype._clickAction = function (x, y, px, py) { if (core.status.event.data.type == 'text') { // 正在淡入淡出的话不执行 if (core.status.event.animateUI) return; + + var data = core.clone(core.status.event.data.current); + if (typeof data == 'string') data = { "type": "text", "text": data }; // 打字机效果显示全部文字 if (core.status.event.interval != null) { - core.insertAction({"type": "text", "text": core.status.event.ui, "showAll": true}); + data.showAll = true; + core.insertAction(data); core.doAction(); return; } @@ -1124,10 +1128,13 @@ actions.prototype._keyUpAction = function (keycode) { // 正在淡入淡出的话不执行 if (core.status.event.animateUI) return; + var data = core.clone(core.status.event.data.current); + if (typeof data == 'string') data = { "type": "text", "text": data }; + // 打字机效果显示全部文字 if (core.status.event.interval != null) { - core.insertAction({"type": "text", "text": core.status.event.ui, "showAll": true}); - core.doAction(); + data.showAll = true; + core.insertAction(data); return; } core.ui._animateUI('hide', core.doAction); diff --git a/libs/ui.js b/libs/ui.js index 3ee3d1fd..1e340294 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -814,7 +814,7 @@ ui.prototype._getPosition = function (content) { px = core.status.event.data.x; py = core.status.event.data.y; } - if (editor.mode != 'play') { + if (main.mode != 'play') { px = editor.pos.x; py = editor.pos.y; } @@ -1413,8 +1413,6 @@ ui.prototype._animateUI = function (type, callback) { ////// 绘制一个对话框 ////// ui.prototype.drawTextBox = function(content, config) { config = config || {}; - if (core.status.event && core.status.event.id == 'action') - core.status.event.ui = content; this.clearUI();