From d97b06a9ac04a898b1c17abc7c51b435d0a387b6 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Sun, 20 Apr 2025 10:59:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=87=AA=E5=8A=A8=E5=AD=98=E6=A1=A3?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=E5=BE=AE=E8=B0=83:=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E9=AB=98=E6=88=90=E6=9C=AC=E4=BD=8E=E6=94=B6?= =?UTF-8?q?=E7=9B=8A=EF=BC=8C=E6=9A=82=E6=97=B6=E6=92=A4=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 54 +++++++++++++++------------------------------- project/plugins.js | 1 - 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/libs/control.js b/libs/control.js index 5b7c34eb..d2ed4462 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2171,50 +2171,30 @@ control.prototype._doSL_save = function (id) { return; } -control.prototype.compareSave = function (data1, data2) { - for (let status in data1) { - if (data1.hasOwnProperty(status) && !['hero', 'time'].includes(status)) { - if (!core.utils.deepEqual(data1[status], data2[status])) return false; - } - } - const hero1 = data1.hero, - hero2 = data2.hero; - for (let status in hero1) { - if (hero1.hasOwnProperty(status) && status !== 'statistics') { - if (!core.utils.deepEqual(hero1[status], hero2[status])) return false; - } - } - return true; -} - control.prototype._doSL_load = function (id, callback) { - if (id == 'autoSave' && core.saves.autosave.data != null) { + const autosave = core.saves.autosave; + if (id == 'autoSave' && autosave.data != null) { let tip = '读档成功'; - core.saves.autosave.now -= 1; - var data = core.saves.autosave.data.splice(core.saves.autosave.now, 1)[0]; + autosave.now -= 1; + var data = autosave.data.splice(autosave.now, 1)[0]; if (core.isPlaying() && !core.status.gameOver) { core.control.autosave(0); - core.saves.autosave.now -= 1; + autosave.now -= 1; } - if (core.saves.autosave.now == 0) { - if (core.compareSave(core.saves.autosave.data[0], data)) { - tip = '没有更早的自动存档'; - } - else { - core.saves.autosave.data.unshift(core.clone(data)); - } - core.saves.autosave.now += 1; + if (autosave.now == 0) { + autosave.data.unshift(core.clone(data)); + autosave.now += 1; } - callback(id, data, tip); + callback(id, data); } else { core.getLocalForage(id == 'autoSave' ? id : "save" + id, null, function (data) { - if (id == 'autoSave' && data != null) { - core.saves.autosave.data = data; - if (!(core.saves.autosave.data instanceof Array)) { - core.saves.autosave.data = [core.saves.autosave.data]; + if (id == 'autoSave' && data != null) { + autosave.data = data; + if (!(autosave.data instanceof Array)) { + autosave.data = [autosave.data]; } - core.saves.autosave.now = core.saves.autosave.data.length; + autosave.now = autosave.data.length; return core.control._doSL_load(id, callback); } callback(id, data); @@ -2236,7 +2216,7 @@ control.prototype._doSL_reload = function (id, callback) { return; } -control.prototype._doSL_load_afterGet = function (id, data, tip = "读档成功") { +control.prototype._doSL_load_afterGet = function (id, data) { if (!data) return alert("无效的存档"); var _replay = function () { core.startGame(data.hard, data.hero.flags.__seed__, core.decodeRoute(data.route)); @@ -2252,7 +2232,7 @@ control.prototype._doSL_load_afterGet = function (id, data, tip = "读档成功" core.ui.closePanel(); core.loadData(data, function () { core.removeFlag('__fromLoad__'); - core.drawTip(tip); + core.drawTip("读档成功"); if (id != "autoSave") { core.saves.saveIndex = id; core.setLocalStorage('saveIndex', core.saves.saveIndex); @@ -3256,7 +3236,7 @@ control.prototype._updateStatusBar_setToolboxIcon = function () { core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src; core.statusBar.image.fly.style.opacity = 1; } - core.statusBar.image.undoRollback.style.opacity = (core.saves.autosave.now === core.saves.autosave.data.length) ? 0.3 : 1; + core.statusBar.image.undoRollback.style.opacity = (core.saves.autosave.now === core.saves.autosave.data?.length) ? 0.3 : 1; core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src; core.statusBar.image.keyboard.src = core.statusBar.icons.keyboard.src; core.statusBar.image.shop.src = core.statusBar.icons.shop.src; diff --git a/project/plugins.js b/project/plugins.js index fec18d08..9a97d646 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -3024,7 +3024,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font); var todo = function () { - //debugger; var id = getSelectedItem(); let hideInfo = core.getFlag('hideInfo', {}); console.log(id);