Add files via upload
This commit is contained in:
parent
cf32b4395d
commit
56dd41bdec
@ -1884,7 +1884,7 @@ control.prototype.getSave = function (index, callback) {
|
|||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// --- 自动存档先从缓存中获取
|
// --- 自动存档先从缓存中获取
|
||||||
if (core.saves.autosave.data != null)
|
if (core.saves.autosave.data != null)
|
||||||
callback(core.saves.autosave.data,core.saves.autosave.now);
|
callback(core.saves.autosave.data);
|
||||||
else {
|
else {
|
||||||
core.getLocalForage("autoSave", null, function(data) {
|
core.getLocalForage("autoSave", null, function(data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
@ -1894,7 +1894,7 @@ control.prototype.getSave = function (index, callback) {
|
|||||||
}
|
}
|
||||||
core.saves.autosave.now=core.saves.autosave.data.length;
|
core.saves.autosave.now=core.saves.autosave.data.length;
|
||||||
}
|
}
|
||||||
callback(core.saves.autosave.data,-1);
|
callback(core.saves.autosave.data);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
main.log(err);
|
main.log(err);
|
||||||
callback(null,-1);
|
callback(null,-1);
|
||||||
@ -1903,23 +1903,22 @@ control.prototype.getSave = function (index, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.getLocalForage("save"+index, null, function(data) {
|
core.getLocalForage("save"+index, null, function(data) {
|
||||||
if (callback) callback(data,-1);
|
if (callback) callback(data);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
main.log(err);
|
main.log(err);
|
||||||
if (callback) callback(null,-1);
|
if (callback) callback(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
control.prototype.getSaves = function (ids, callback) {
|
control.prototype.getSaves = function (ids, callback) {
|
||||||
if (!(ids instanceof Array)) return this.getSave(ids, callback);
|
if (!(ids instanceof Array)) return this.getSave(ids, callback);
|
||||||
var count = ids.length, data = {},flag=-1;
|
var count = ids.length, data = {};
|
||||||
for (var i = 0; i < ids.length; ++i) {
|
for (var i = 0; i < ids.length; ++i) {
|
||||||
(function (i) {
|
(function (i) {
|
||||||
core.getSave(ids[i], function (result,_flag) {
|
core.getSave(ids[i], function (result) {
|
||||||
data[i] = result;
|
data[i] = result;
|
||||||
if(_flag!=-1)flag=_flag;
|
|
||||||
if (Object.keys(data).length == count)
|
if (Object.keys(data).length == count)
|
||||||
callback(data,flag);
|
callback(data);
|
||||||
})
|
})
|
||||||
})(i);
|
})(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2501,10 +2501,10 @@ ui.prototype._drawSLPanel_loadSave = function(page, callback) {
|
|||||||
id = core.saves.favorite[id - 1]; // 因为favorite第一个不是自动存档 所以要偏移1
|
id = core.saves.favorite[id - 1]; // 因为favorite第一个不是自动存档 所以要偏移1
|
||||||
ids.push(id);
|
ids.push(id);
|
||||||
}
|
}
|
||||||
core.getSaves(ids, function (data, flag) {
|
core.getSaves(ids, function (data) {
|
||||||
for (var i = 1; i < ids.length; ++i)
|
for (var i = 1; i < ids.length; ++i)
|
||||||
core.status.event.ui[i] = data[i];
|
core.status.event.ui[i] = data[i];
|
||||||
core.status.event.ui[0] = data[0] == null ? null : data[0][flag==-1?data[0].length-1:flag-1];
|
core.status.event.ui[0] = data[0] == null ? null : data[0][core.saves.autosave.now-1];
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user