From e7d5a64b7637994eb1be0a4c924041330391154d Mon Sep 17 00:00:00 2001 From: Rintim Date: Sun, 10 Sep 2023 21:06:46 +0800 Subject: [PATCH 1/3] async. --- game/game.js | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/game/game.js b/game/game.js index 8441b63d2..1d344f67b 100644 --- a/game/game.js +++ b/game/game.js @@ -8415,13 +8415,16 @@ styleToLoad--; if(styleToLoad==0){ if(extensionlist.length&&(lib.config.mode!='connect'||show_splash)){ - var extToLoad=extensionlist.length; - var extLoaded=function(){ - extToLoad--; + _status.extensionLoading=[]; + let extToLoad=extensionlist.length; + const extLoaded=gnc.async(function*(){ + --extToLoad; if(extToLoad==0){ + yield Promise.allSettled(_status.extensionLoading); + delete _status.extensionLoading; loadPack(); } - } + }); //读取扩展 var alerted=false; for(var i=0;i Date: Sun, 10 Sep 2023 21:19:48 +0800 Subject: [PATCH 2/3] async fix. --- game/game.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/game/game.js b/game/game.js index 1d344f67b..11e1c67c1 100644 --- a/game/game.js +++ b/game/game.js @@ -8411,8 +8411,8 @@ throw e; }); var styleToLoad=6; - var styleLoaded=function(){ - styleToLoad--; + var styleLoaded=gnc.async(function*(){ + --styleToLoad; if(styleToLoad==0){ if(extensionlist.length&&(lib.config.mode!='connect'||show_splash)){ _status.extensionLoading=[]; @@ -8430,8 +8430,10 @@ for(var i=0;i Date: Sun, 10 Sep 2023 21:21:16 +0800 Subject: [PATCH 3/3] bugfix. --- game/game.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index 11e1c67c1..3182ccabf 100644 --- a/game/game.js +++ b/game/game.js @@ -8439,7 +8439,7 @@ continue; } lib.init.js(lib.assetURL+'extension/'+extensionlist[i],'extension',extLoaded,(function(i){ - return function(){ + return gnc.async(function*(){ game.removeExtension(i); --extToLoad; if(extToLoad==0){ @@ -8447,7 +8447,7 @@ delete _status.extensionLoading; loadPack(); } - } + }); }(extensionlist[i]))); } }