Save Pages
This commit is contained in:
parent
bda274a428
commit
51c7fd2e49
@ -1658,7 +1658,7 @@ actions.prototype.clickSyncSave = function (x,y) {
|
|||||||
|
|
||||||
if (data instanceof Array) {
|
if (data instanceof Array) {
|
||||||
core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?", function () {
|
core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?", function () {
|
||||||
for (var i=1;i<=150;i++) {
|
for (var i=1;i<=5*(main.savePages||30);i++) {
|
||||||
if (i<=data.length) {
|
if (i<=data.length) {
|
||||||
core.setLocalStorage("save"+i, data[i-1]);
|
core.setLocalStorage("save"+i, data[i-1]);
|
||||||
}
|
}
|
||||||
@ -1673,8 +1673,8 @@ actions.prototype.clickSyncSave = function (x,y) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var index=150;
|
var index=5*(main.savePages||30);
|
||||||
for (var i=150;i>=1;i--) {
|
for (var i=5*(main.savePages||30);i>=1;i--) {
|
||||||
if (core.getLocalStorage("save"+i, null)==null)
|
if (core.getLocalStorage("save"+i, null)==null)
|
||||||
index=i;
|
index=i;
|
||||||
else break;
|
else break;
|
||||||
@ -1797,7 +1797,7 @@ actions.prototype.clickLocalSaveSelect = function (x,y) {
|
|||||||
switch (selection) {
|
switch (selection) {
|
||||||
case 0:
|
case 0:
|
||||||
saves=[];
|
saves=[];
|
||||||
for (var i=1;i<=150;i++) {
|
for (var i=1;i<=5*(main.savePages||30);i++) {
|
||||||
var data = core.getLocalStorage("save"+i, null);
|
var data = core.getLocalStorage("save"+i, null);
|
||||||
if (core.isset(data)) {
|
if (core.isset(data)) {
|
||||||
saves.push(data);
|
saves.push(data);
|
||||||
@ -1805,7 +1805,7 @@ actions.prototype.clickLocalSaveSelect = function (x,y) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (var i=150;i>=1;i--) {
|
for (var i=5*(main.savePages||30);i>=1;i--) {
|
||||||
saves=core.getLocalStorage("save"+i, null);
|
saves=core.getLocalStorage("save"+i, null);
|
||||||
if (core.isset(saves)) {
|
if (core.isset(saves)) {
|
||||||
break;
|
break;
|
||||||
@ -1869,7 +1869,7 @@ actions.prototype.clickStorageRemove = function (x, y) {
|
|||||||
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (var i=1;i<=150;i++) {
|
for (var i=1;i<=5*(main.savePages||30);i++) {
|
||||||
core.removeLocalStorage("save"+i);
|
core.removeLocalStorage("save"+i);
|
||||||
}
|
}
|
||||||
core.drawText("\t[操作成功]当前塔的存档已被清空。");
|
core.drawText("\t[操作成功]当前塔的存档已被清空。");
|
||||||
|
|||||||
@ -1550,9 +1550,9 @@ control.prototype.replay = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.status.replay.steps++;
|
core.status.replay.steps++;
|
||||||
if (core.status.replay.steps%20==0) {
|
if (core.status.replay.steps%50==0) {
|
||||||
if (core.status.replay.save.length == 30)
|
//if (core.status.replay.save.length == 30)
|
||||||
core.status.replay.save.shift();
|
// core.status.replay.save.shift();
|
||||||
core.status.replay.save.push({"data": core.saveData(), "replay": {
|
core.status.replay.save.push({"data": core.saveData(), "replay": {
|
||||||
"totalList": core.clone(core.status.replay.totalList),
|
"totalList": core.clone(core.status.replay.totalList),
|
||||||
"toReplay": core.clone(core.status.replay.toReplay),
|
"toReplay": core.clone(core.status.replay.toReplay),
|
||||||
@ -1584,7 +1584,7 @@ control.prototype.replay = function () {
|
|||||||
core.useItem(itemId, function () {
|
core.useItem(itemId, function () {
|
||||||
core.replay();
|
core.replay();
|
||||||
});
|
});
|
||||||
}, 750 / Math.sqrt(core.status.replay.speed));
|
}, 750 / core.status.replay.speed);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1602,7 +1602,7 @@ control.prototype.replay = function () {
|
|||||||
core.changeFloor(floorId, stair, null, null, function () {
|
core.changeFloor(floorId, stair, null, null, function () {
|
||||||
core.replay();
|
core.replay();
|
||||||
});
|
});
|
||||||
}, 750 / Math.sqrt(core.status.replay.speed));
|
}, 750 / core.status.replay.speed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1635,7 +1635,7 @@ control.prototype.replay = function () {
|
|||||||
core.status.event.selection = parseInt(selections.shift());
|
core.status.event.selection = parseInt(selections.shift());
|
||||||
core.events.openShop(shopId, false);
|
core.events.openShop(shopId, false);
|
||||||
|
|
||||||
}, 750 / Math.sqrt(core.status.replay.speed));
|
}, 750 / core.status.replay.speed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1898,7 +1898,7 @@ control.prototype.syncSave = function (type) {
|
|||||||
// data
|
// data
|
||||||
if (type=='all') {
|
if (type=='all') {
|
||||||
saves=[];
|
saves=[];
|
||||||
for (var i=1;i<=150;i++) {
|
for (var i=1;i<=5*(main.savePages||30);i++) {
|
||||||
var data = core.getLocalStorage("save"+i, null);
|
var data = core.getLocalStorage("save"+i, null);
|
||||||
if (core.isset(data)) {
|
if (core.isset(data)) {
|
||||||
saves.push(data);
|
saves.push(data);
|
||||||
@ -1906,7 +1906,7 @@ control.prototype.syncSave = function (type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var i=150;i>=1;i--) {
|
for (var i=5*(main.savePages||30);i>=1;i--) {
|
||||||
saves=core.getLocalStorage("save"+i, null);
|
saves=core.getLocalStorage("save"+i, null);
|
||||||
if (core.isset(saves)) {
|
if (core.isset(saves)) {
|
||||||
break;
|
break;
|
||||||
@ -1967,7 +1967,7 @@ control.prototype.syncLoad = function () {
|
|||||||
if (data instanceof Array) {
|
if (data instanceof Array) {
|
||||||
core.status.event.selection=1;
|
core.status.event.selection=1;
|
||||||
core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?", function () {
|
core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?", function () {
|
||||||
for (var i=1;i<=150;i++) {
|
for (var i=1;i<=5*(main.savePages||30);i++) {
|
||||||
if (i<=data.length) {
|
if (i<=data.length) {
|
||||||
core.setLocalStorage("save"+i, data[i-1]);
|
core.setLocalStorage("save"+i, data[i-1]);
|
||||||
}
|
}
|
||||||
@ -1983,8 +1983,8 @@ control.prototype.syncLoad = function () {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 只覆盖单存档
|
// 只覆盖单存档
|
||||||
var index=150;
|
var index=5*(main.savePages||30);
|
||||||
for (var i=150;i>=1;i--) {
|
for (var i=5*(main.savePages||30);i>=1;i--) {
|
||||||
if (core.getLocalStorage("save"+i, null)==null)
|
if (core.getLocalStorage("save"+i, null)==null)
|
||||||
index=i;
|
index=i;
|
||||||
else break;
|
else break;
|
||||||
|
|||||||
@ -678,7 +678,7 @@ events.prototype.doAction = function() {
|
|||||||
core.status.route.push("choices:"+index);
|
core.status.route.push("choices:"+index);
|
||||||
core.events.insertAction(data.choices[index].action);
|
core.events.insertAction(data.choices[index].action);
|
||||||
core.events.doAction();
|
core.events.doAction();
|
||||||
}, 750 / Math.sqrt(core.status.replay.speed))
|
}, 750 / core.status.replay.speed)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
|
|||||||
@ -1571,7 +1571,8 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
if (index<0) index=0;
|
if (index<0) index=0;
|
||||||
|
|
||||||
var page = parseInt(index/10), offset=index%10;
|
var page = parseInt(index/10), offset=index%10;
|
||||||
if (page>=30) page=29;
|
var max_page = main.savePages || 30;
|
||||||
|
if (page>=max_page) page=max_page - 1;
|
||||||
if (offset>5) offset=5;
|
if (offset>5) offset=5;
|
||||||
index=10*page+offset;
|
index=10*page+offset;
|
||||||
|
|
||||||
@ -1617,7 +1618,7 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.drawPagination(page+1, 30);
|
this.drawPagination(page+1, max_page);
|
||||||
|
|
||||||
if (core.status.event.selection)
|
if (core.status.event.selection)
|
||||||
core.setFillStyle('ui', '#FF6A6A');
|
core.setFillStyle('ui', '#FF6A6A');
|
||||||
|
|||||||
2
main.js
2
main.js
@ -14,6 +14,8 @@ function main() {
|
|||||||
|
|
||||||
this.isCompetition = false; // 是否是比赛模式
|
this.isCompetition = false; // 是否是比赛模式
|
||||||
|
|
||||||
|
this.savePages = 30; // 存档页数,每页可存5个;默认为30页150个存档
|
||||||
|
|
||||||
//------------------------ 用户修改内容 END ------------------------//
|
//------------------------ 用户修改内容 END ------------------------//
|
||||||
|
|
||||||
this.dom = {
|
this.dom = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user