From a1ddca606c6a11edc2a905249038aa568188eef2 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 6 Sep 2021 17:00:57 +0800 Subject: [PATCH 1/2] Fix doAction when setValue lose --- libs/events.js | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/events.js b/libs/events.js index 70f01d15..de8a0dce 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1877,6 +1877,7 @@ events.prototype._action_setValue = function (data, x, y, prefix) { core.status.hero.hp = 0; core.updateStatusBar(); core.events.lose(); + return; } else { core.updateStatusBar(); } From 1fab8b94f4819e489b9b00539a34cf781fec0ddc Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 6 Sep 2021 17:19:34 +0800 Subject: [PATCH 2/2] Fix replay failed & doAction --- libs/control.js | 8 +++++++- libs/core.js | 1 + libs/events.js | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/control.js b/libs/control.js index 49948869..94c668d7 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1336,6 +1336,7 @@ control.prototype.startReplay = function (list) { if (!core.isPlaying()) return; core.status.replay.replaying=true; core.status.replay.pausing=true; + core.status.replay.failed = false; core.status.replay.speed=1.0; core.status.replay.toReplay = core.cloneArray(list); core.status.replay.totalList = core.status.route.concat(list); @@ -1431,6 +1432,7 @@ control.prototype.stopReplay = function (force) { core.status.replay.totalList = []; core.status.replay.replaying=false; core.status.replay.pausing=false; + core.status.replay.failed = false; core.status.replay.speed=1.0; core.status.replay.steps = 0; core.status.replay.save = []; @@ -1586,7 +1588,7 @@ control.prototype.isReplaying = function () { ////// 回放 ////// control.prototype.replay = function (force) { if (!core.isPlaying() || !core.isReplaying() - || core.status.replay.animate || core.status.event.id) return; + || core.status.replay.animate || core.status.event.id || core.status.replay.failed) return; if (core.status.replay.pausing && !force) return; this._replay_drawProgress(); if (core.status.replay.toReplay.length==0) @@ -1628,6 +1630,7 @@ control.prototype._doReplayAction = function (action) { control.prototype._replay_finished = function () { core.status.replay.replaying = false; + core.status.replay.failed = false; core.status.event.selection = 0; var str = "录像播放完毕,你想退出播放吗?"; if (core.status.route.length != core.status.replay.totalList.length @@ -1660,6 +1663,7 @@ control.prototype._replay_save = function () { control.prototype._replay_error = function (action, callback) { core.ui.closePanel(); core.status.replay.replaying = false; + core.status.replay.failed = true; var len = core.status.replay.toReplay.length; var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1); var nextList = core.status.replay.toReplay.slice(0, 10); @@ -1667,6 +1671,7 @@ control.prototype._replay_error = function (action, callback) { main.log("之前的10个操作是:\n" + prevList.toString()); main.log("接下来10个操作是:\n" + nextList.toString()); core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () { + core.status.replay.failed = false; core.ui.closePanel(); if (core.status.replay.save.length > 0) { core.status.replay.replaying = true; @@ -1680,6 +1685,7 @@ control.prototype._replay_error = function (action, callback) { if (callback) callback(); } }, function () { + core.status.replay.failed = false; core.ui.closePanel(); core.stopReplay(true); if (callback) callback(); diff --git a/libs/core.js b/libs/core.js index 9d405bf2..804cbacf 100644 --- a/libs/core.js +++ b/libs/core.js @@ -193,6 +193,7 @@ function core() { 'replaying': false, 'pausing': false, 'animate': false, // 正在某段动画中 + 'failed': false, 'toReplay': [], 'totalList': [], 'speed': 1.0, diff --git a/libs/events.js b/libs/events.js index de8a0dce..0b97fe66 100644 --- a/libs/events.js +++ b/libs/events.js @@ -992,6 +992,7 @@ events.prototype.doAction = function () { clearInterval(core.status.event.animateUI); core.status.event.interval = null; delete core.status.event.aniamteUI; + if (core.status.gameOver || core.status.replay.failed) return; core.clearUI(); // 判定是否执行完毕 if (this._doAction_finishEvents()) return; @@ -1015,8 +1016,6 @@ events.prototype.doAction = function () { } events.prototype._doAction_finishEvents = function () { - if (core.status.gameOver) return true; - // 事件处理完毕 if (core.status.event.data.list.length == 0) { // 检测并执行延迟自动事件 @@ -1877,7 +1876,6 @@ events.prototype._action_setValue = function (data, x, y, prefix) { core.status.hero.hp = 0; core.updateStatusBar(); core.events.lose(); - return; } else { core.updateStatusBar(); }