fix:尝试禁用自动导出本地存档功能,效果待测试
This commit is contained in:
parent
3db2604d95
commit
8b6664c2f0
@ -69,41 +69,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var _export = function () {
|
// var _export = function () {
|
||||||
var toExport = [];
|
// var toExport = [];
|
||||||
|
|
||||||
localforage.iterate(function (value, key, n) {
|
// localforage.iterate(function (value, key, n) {
|
||||||
if (value == null || !key.startsWith(core.firstData.name)) return;
|
// if (value == null || !key.startsWith(core.firstData.name)) return;
|
||||||
value = core.decompress(value);
|
// value = core.decompress(value);
|
||||||
if (value == null) return;
|
// if (value == null) return;
|
||||||
var str = JSON.stringify(value).replace(/[\u007F-\uFFFF]/g, function (chr) {
|
// var str = JSON.stringify(value).replace(/[\u007F-\uFFFF]/g, function (chr) {
|
||||||
return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4)
|
// return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4)
|
||||||
});
|
// });
|
||||||
str = LZString.compressToBase64(str);
|
// str = LZString.compressToBase64(str);
|
||||||
toExport.push(key);
|
// toExport.push(key);
|
||||||
core.saves.cache[key] = str;
|
// core.saves.cache[key] = str;
|
||||||
fs.writeFile('_saves/' + key, str, 'utf-8', function () {});
|
// fs.writeFile('_saves/' + key, str, 'utf-8', function () {});
|
||||||
}, function () {
|
// }, function () {
|
||||||
if (toExport.length > 0) {
|
// if (toExport.length > 0) {
|
||||||
alert('提示!本塔已开启存档本地化!原始存档已全部导出至 _saves/ 目录下。');
|
// alert('提示!本塔已开启存档本地化!原始存档已全部导出至 _saves/ 目录下。');
|
||||||
}
|
// }
|
||||||
fs.writeFile('_saves/.exported', '1', 'utf-8', function () {});
|
// fs.writeFile('_saves/.exported', '1', 'utf-8', function () {});
|
||||||
rewrite();
|
// rewrite();
|
||||||
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
// core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
fs.mkdir('_saves', function (err) {
|
fs.mkdir('_saves', function (err) {
|
||||||
if (err) return;
|
if (err) return;
|
||||||
|
|
||||||
fs.readFile('_saves/.exported', 'utf-8', function(err, data) {
|
// === 禁用自动导出功能,避免影响造塔 === //
|
||||||
if (!err && data) {
|
rewrite();
|
||||||
rewrite();
|
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||||
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
// fs.readFile('_saves/.exported', 'utf-8', function(err, data) {
|
||||||
return;
|
// if (!err && data) {
|
||||||
}
|
// rewrite();
|
||||||
_export();
|
// core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||||
});
|
// return;
|
||||||
|
// }
|
||||||
|
// _export();
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user