From e6c41b37dd2a9128796911f53594355892f8d39b Mon Sep 17 00:00:00 2001 From: nonameShijian <2954700422@qq.com> Date: Fri, 19 Jan 2024 01:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgame.belongAsyncEvent?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=B8=8D=E6=98=8E=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/game/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index 9b2379276..bbfd85079 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -5364,10 +5364,11 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [belongAsyncEvent] */ static async loop(belongAsyncEvent) { + if (!game.belongAsyncEventList) game.belongAsyncEventList = []; if (belongAsyncEvent) { - game.belongAsyncEvent = belongAsyncEvent; - } else if (game.belongAsyncEvent) { - return game.loop(game.belongAsyncEvent); + game.belongAsyncEventList.push(belongAsyncEvent); + } else if (game.belongAsyncEventList.length) { + belongAsyncEvent = game.belongAsyncEventList.at(-1); } while (true) { let event = (belongAsyncEvent && belongAsyncEvent.parent == _status.event) ? belongAsyncEvent : _status.event; @@ -5444,9 +5445,8 @@ export class Game extends Uninstantable { if (event.result) { event.parent._result = event.result; } - _status.event = event.parent; - if (game.belongAsyncEvent == event) { - delete game.belongAsyncEvent; + if (game.belongAsyncEventList.includes(event)) { + game.belongAsyncEventList.remove(event); } _resolve(); // 此时应该退出了 @@ -5455,8 +5455,8 @@ export class Game extends Uninstantable { } } else { - if (game.belongAsyncEvent == event) { - delete game.belongAsyncEvent; + if (game.belongAsyncEventList.includes(event)) { + game.belongAsyncEventList.remove(event); } return _resolve(); }