Fix autosave
This commit is contained in:
parent
7a50a3c674
commit
af682ca837
@ -2305,6 +2305,7 @@ actions.prototype._clickStorageRemove_all = function () {
|
|||||||
core.saves.ids = {};
|
core.saves.ids = {};
|
||||||
core.saves.autosave.data = null;
|
core.saves.autosave.data = null;
|
||||||
core.saves.autosave.updated = false;
|
core.saves.autosave.updated = false;
|
||||||
|
core.saves.autosave.now = 0;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.saves.saveIndex = 1;
|
core.saves.saveIndex = 1;
|
||||||
core.saves.favorite = [];
|
core.saves.favorite = [];
|
||||||
@ -2330,6 +2331,7 @@ actions.prototype._clickStorageRemove_current = function () {
|
|||||||
core.saves.ids = {};
|
core.saves.ids = {};
|
||||||
core.saves.autosave.data = null;
|
core.saves.autosave.data = null;
|
||||||
core.saves.autosave.updated = false;
|
core.saves.autosave.updated = false;
|
||||||
|
core.saves.autosave.now = 0;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.saves.saveIndex = 1;
|
core.saves.saveIndex = 1;
|
||||||
core.saves.favorite = [];
|
core.saves.favorite = [];
|
||||||
|
|||||||
@ -1604,10 +1604,10 @@ control.prototype.autosave = function (removeLast) {
|
|||||||
if (core.saves.autosave.data == null) {
|
if (core.saves.autosave.data == null) {
|
||||||
core.saves.autosave.data = [];
|
core.saves.autosave.data = [];
|
||||||
}
|
}
|
||||||
core.saves.autosave.data.splice(core.saves.autosave.now,0,core.saveData());
|
core.saves.autosave.data.splice(core.saves.autosave.now, 0, core.saveData());
|
||||||
core.saves.autosave.now=core.saves.autosave.now+1;
|
core.saves.autosave.now = core.saves.autosave.now + 1;
|
||||||
if (core.saves.autosave.data.length > core.saves.autosave.max) {
|
if (core.saves.autosave.data.length > core.saves.autosave.max) {
|
||||||
if(core.saves.autosave.now<core.saves.autosave.max/2) core.saves.autosave.data.pop();
|
if (core.saves.autosave.now < core.saves.autosave.max / 2) core.saves.autosave.data.pop();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
core.saves.autosave.data.shift();
|
core.saves.autosave.data.shift();
|
||||||
@ -1631,7 +1631,7 @@ control.prototype.checkAutosave = function () {
|
|||||||
if (autosave.data == null || !autosave.updated || !autosave.storage) return;
|
if (autosave.data == null || !autosave.updated || !autosave.storage) return;
|
||||||
autosave.updated = false;
|
autosave.updated = false;
|
||||||
if (autosave.data.length >= 1) {
|
if (autosave.data.length >= 1) {
|
||||||
core.setLocalForage("autoSave", autosave.data[autosave.now-1]);
|
core.setLocalForage("autoSave", autosave.data[autosave.now - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1652,7 +1652,7 @@ control.prototype._doSL_save = function (id) {
|
|||||||
if (core.status.event.interval != null)
|
if (core.status.event.interval != null)
|
||||||
core.setFlag("__events__", core.status.event.interval);
|
core.setFlag("__events__", core.status.event.interval);
|
||||||
core.setLocalForage("save"+id, core.saveData(), function() {
|
core.setLocalForage("save"+id, core.saveData(), function() {
|
||||||
core.saves.saveIndex=id;
|
core.saves.saveIndex = id;
|
||||||
core.setLocalStorage('saveIndex', core.saves.saveIndex);
|
core.setLocalStorage('saveIndex', core.saves.saveIndex);
|
||||||
// 恢复事件
|
// 恢复事件
|
||||||
if (!core.events.recoverEvents(core.status.event.interval))
|
if (!core.events.recoverEvents(core.status.event.interval))
|
||||||
@ -1673,17 +1673,12 @@ control.prototype._doSL_save = function (id) {
|
|||||||
|
|
||||||
control.prototype._doSL_load = function (id, callback) {
|
control.prototype._doSL_load = function (id, callback) {
|
||||||
if (id == 'autoSave' && core.saves.autosave.data != null) {
|
if (id == 'autoSave' && core.saves.autosave.data != null) {
|
||||||
core.saves.autosave.now=core.saves.autosave.now-1;
|
core.saves.autosave.now -= 1;
|
||||||
var data = core.saves.autosave.data.splice(core.saves.autosave.now,1)[0];
|
var data = core.saves.autosave.data.splice(core.saves.autosave.now, 1)[0];
|
||||||
if(core.status.played && !core.status.gameOver)
|
|
||||||
{
|
|
||||||
core.control.autosave(0);
|
|
||||||
core.saves.autosave.now=core.saves.autosave.now-1;
|
|
||||||
}
|
|
||||||
if(core.saves.autosave.now==0)
|
if(core.saves.autosave.now==0)
|
||||||
{
|
{
|
||||||
core.saves.autosave.data.unshift(core.clone(data));
|
core.saves.autosave.data.unshift(core.clone(data));
|
||||||
core.saves.autosave.now=core.saves.autosave.now+1;
|
core.saves.autosave.now += 1;
|
||||||
}
|
}
|
||||||
callback(id, data);
|
callback(id, data);
|
||||||
}
|
}
|
||||||
@ -1694,7 +1689,7 @@ control.prototype._doSL_load = function (id, callback) {
|
|||||||
if (!(core.saves.autosave.data instanceof Array)) {
|
if (!(core.saves.autosave.data instanceof Array)) {
|
||||||
core.saves.autosave.data = [core.saves.autosave.data];
|
core.saves.autosave.data = [core.saves.autosave.data];
|
||||||
}
|
}
|
||||||
core.saves.autosave.now=core.saves.autosave.data.length;
|
core.saves.autosave.now = core.saves.autosave.data.length;
|
||||||
return core.control._doSL_load(id, callback);
|
return core.control._doSL_load(id, callback);
|
||||||
}
|
}
|
||||||
callback(id, data);
|
callback(id, data);
|
||||||
@ -1707,9 +1702,9 @@ control.prototype._doSL_load = function (id, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
control.prototype._doSL_reload = function (id, callback) {
|
control.prototype._doSL_reload = function (id, callback) {
|
||||||
if (core.saves.autosave.data!=null&&core.saves.autosave.now < core.saves.autosave.data.length) {
|
if (core.saves.autosave.data != null && core.saves.autosave.now < core.saves.autosave.data.length) {
|
||||||
var data = core.saves.autosave.data.splice(core.saves.autosave.now,1)[0];
|
var data = core.saves.autosave.data.splice(core.saves.autosave.now, 1)[0];
|
||||||
core.control.autosave(0);
|
core.control.autosave(false);
|
||||||
callback(id, data);
|
callback(id, data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1893,7 +1888,7 @@ control.prototype.getSave = function (index, callback) {
|
|||||||
if (!(core.saves.autosave.data instanceof Array)) {
|
if (!(core.saves.autosave.data instanceof Array)) {
|
||||||
core.saves.autosave.data = [core.saves.autosave.data];
|
core.saves.autosave.data = [core.saves.autosave.data];
|
||||||
}
|
}
|
||||||
core.saves.autosave.now=core.saves.autosave.data.length;
|
core.saves.autosave.now = core.saves.autosave.data.length;
|
||||||
}
|
}
|
||||||
callback(core.saves.autosave.data);
|
callback(core.saves.autosave.data);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
|
|||||||
@ -922,13 +922,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
case 118: // F7:开启debug模式
|
case 118: // F7:开启debug模式
|
||||||
core.debug();
|
core.debug();
|
||||||
break;
|
break;
|
||||||
/*case 87: // W:开启技能“二倍斩”
|
case 70: // F:开启技能“二倍斩”
|
||||||
// 检测是否拥有“二倍斩”这个技能道具
|
// 检测是否拥有“二倍斩”这个技能道具
|
||||||
if (core.hasItem('skill1')) {
|
if (core.hasItem('skill1')) {
|
||||||
core.status.route.push("key:87");
|
core.status.route.push("key:70");
|
||||||
core.useItem('skill1', true);
|
core.useItem('skill1', true);
|
||||||
}
|
}
|
||||||
break;*/
|
break;
|
||||||
// 在这里可以任意新增或编辑已有的快捷键内容
|
// 在这里可以任意新增或编辑已有的快捷键内容
|
||||||
/*
|
/*
|
||||||
case 0: // 使用该按键的keyCode
|
case 0: // 使用该按键的keyCode
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
原先的版本中A键可以回到之前的自动存档状态
|
|
||||||
现在A和W可以在最近的若干状态来回滚动
|
|
||||||
为了方便手机 默认56两个数字键是同样功能 可在按键设置中自己修改
|
|
||||||
Loading…
Reference in New Issue
Block a user