optimize autosave

This commit is contained in:
ckcz123 2019-12-31 10:26:29 +08:00
parent 1d271648d2
commit f4c200d3fb
2 changed files with 7 additions and 3 deletions

View File

@ -1621,9 +1621,12 @@ control.prototype.autosave = function (removeLast) {
control.prototype.checkAutosave = function () {
if (!core.animateFrame || !core.saves || !core.saves.autosave) return;
core.setLocalStorage('totalTime', core.animateFrame.totalTime);
if (core.saves.autosave.data == null || !core.saves.autosave.updated) return;
core.saves.autosave.updated = false;
core.setLocalForage("autoSave", core.saves.autosave.data);
var autosave = core.saves.autosave;
if (autosave.data == null || !autosave.updated || !autosave.storage) return;
autosave.updated = false;
if (autosave.data.length >= 1) {
core.setLocalForage("autoSave", autosave.data[autosave.data.length - 1]);
}
}
////// 实际进行存读档事件 //////

View File

@ -106,6 +106,7 @@ function core() {
"data": null,
"time": 0,
"updated": false,
"storage": true, // 是否把自动存档写入文件a
"max": 10, // 自动存档最大回退数
},
"favorite": [],