From 283df5fca693bb3732e84367f4d2a51491ef9ef6 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 6 Nov 2024 15:06:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AD=98=E6=A1=A3=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/control.js | 6 +++--- src/game/index.ts | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/libs/control.js b/public/libs/control.js index fcd664c..d732f79 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -186,9 +186,9 @@ control.prototype._animationFrame_totalTime = function (timestamp) { }; control.prototype._animationFrame_autoSave = function (timestamp) { - if (timestamp - core.saves.autosave.time <= 5000) return; - core.control.checkAutosave(); - core.saves.autosave.time = timestamp; + // if (timestamp - core.saves.autosave.time <= 5000) return; + // core.control.checkAutosave(); + // core.saves.autosave.time = timestamp; }; control.prototype._animationFrame_globalAnimate = function (timestamp) { diff --git a/src/game/index.ts b/src/game/index.ts index 65d5ae8..b61d3f7 100644 --- a/src/game/index.ts +++ b/src/game/index.ts @@ -52,3 +52,10 @@ loading.once('coreInit', () => { }); registerPresetState(); + +window.addEventListener('beforeunload', () => { + core.checkAutosave(); +}); +hook.on('restart', () => { + core.checkAutosave(); +});