From 8b6664c2f01fdd1826707f59fdef4b238c604b0c Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Wed, 13 Aug 2025 21:49:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=B0=9D=E8=AF=95=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AF=BC=E5=87=BA=E6=9C=AC=E5=9C=B0=E5=AD=98?= =?UTF-8?q?=E6=A1=A3=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=95=88=E6=9E=9C=E5=BE=85?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/localSave.js | 65 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/extensions/localSave.js b/extensions/localSave.js index 8a4eb22a..88285041 100644 --- a/extensions/localSave.js +++ b/extensions/localSave.js @@ -10,7 +10,7 @@ // 将这一行改成 false 可以禁用本拓展 var __enabled = false; - if (window.jsinterface || !window.fs || !__enabled) return; + if (window.jsinterface || !window.fs || !__enabled) return; function rewrite() { core.utils._setLocalForage_set = function (name, str, callback) { @@ -69,41 +69,44 @@ } - var _export = function () { - var toExport = []; + // var _export = function () { + // var toExport = []; - localforage.iterate(function (value, key, n) { - if (value == null || !key.startsWith(core.firstData.name)) return; - value = core.decompress(value); - if (value == null) return; - var str = JSON.stringify(value).replace(/[\u007F-\uFFFF]/g, function (chr) { - return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4) - }); - str = LZString.compressToBase64(str); - toExport.push(key); - core.saves.cache[key] = str; - fs.writeFile('_saves/' + key, str, 'utf-8', function () {}); - }, function () { - if (toExport.length > 0) { - alert('提示!本塔已开启存档本地化!原始存档已全部导出至 _saves/ 目录下。'); - } - fs.writeFile('_saves/.exported', '1', 'utf-8', function () {}); - rewrite(); - core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; }); - }); - } + // localforage.iterate(function (value, key, n) { + // if (value == null || !key.startsWith(core.firstData.name)) return; + // value = core.decompress(value); + // if (value == null) return; + // var str = JSON.stringify(value).replace(/[\u007F-\uFFFF]/g, function (chr) { + // return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4) + // }); + // str = LZString.compressToBase64(str); + // toExport.push(key); + // core.saves.cache[key] = str; + // fs.writeFile('_saves/' + key, str, 'utf-8', function () {}); + // }, function () { + // if (toExport.length > 0) { + // alert('提示!本塔已开启存档本地化!原始存档已全部导出至 _saves/ 目录下。'); + // } + // fs.writeFile('_saves/.exported', '1', 'utf-8', function () {}); + // rewrite(); + // core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; }); + // }); + // } fs.mkdir('_saves', function (err) { if (err) return; - fs.readFile('_saves/.exported', 'utf-8', function(err, data) { - if (!err && data) { - rewrite(); - core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; }); - return; - } - _export(); - }); + // === 禁用自动导出功能,避免影响造塔 === // + rewrite(); + core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; }); + // fs.readFile('_saves/.exported', 'utf-8', function(err, data) { + // if (!err && data) { + // rewrite(); + // core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; }); + // return; + // } + // _export(); + // }); }); })();