Remove Storage
This commit is contained in:
parent
79f0854371
commit
93ee7f0415
@ -128,6 +128,10 @@ actions.prototype.keyDown = function(keyCode) {
|
||||
this.keyDownLocalSaveSelect(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='storageRemove') {
|
||||
this.keyDownStorageRemove(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='cursor') {
|
||||
this.keyDownCursor(keyCode);
|
||||
return;
|
||||
@ -255,7 +259,10 @@ actions.prototype.keyUp = function(keyCode) {
|
||||
this.keyUpLocalSaveSelect(keyCode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.status.event.id=='storageRemove') {
|
||||
this.keyUpStorageRemove(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='cursor') {
|
||||
this.keyUpCursor(keyCode);
|
||||
return;
|
||||
@ -649,6 +656,10 @@ actions.prototype.onclick = function (x, y, stepPostfix) {
|
||||
this.clickLocalSaveSelect(x,y);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='storageRemove') {
|
||||
this.clickStorageRemove(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.status.event.id == 'cursor') {
|
||||
this.clickCursor(x,y);
|
||||
@ -1628,14 +1639,8 @@ actions.prototype.clickSyncSave = function (x,y) {
|
||||
}));
|
||||
break;
|
||||
case 5:
|
||||
core.status.event.selection=1;
|
||||
core.ui.drawConfirmBox("你确定要清空所有存档吗?", function() {
|
||||
localStorage.clear();
|
||||
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
||||
}, function() {
|
||||
core.status.event.selection=5;
|
||||
core.ui.drawSyncSave();
|
||||
})
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawStorageRemove();
|
||||
break;
|
||||
case 6:
|
||||
core.status.event.selection=3;
|
||||
@ -1793,6 +1798,61 @@ actions.prototype.keyUpLocalSaveSelect = function (keycode) {
|
||||
}
|
||||
}
|
||||
|
||||
////// 存档删除界面时的点击操作 //////
|
||||
actions.prototype.clickStorageRemove = function (x, y) {
|
||||
if (x<5 || x>7) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||
|
||||
if (y>=topIndex && y<topIndex+choices.length) {
|
||||
var selection = y - topIndex;
|
||||
switch (selection) {
|
||||
case 0:
|
||||
localStorage.clear();
|
||||
core.drawText("\t[操作成功]你的所有存档已被清空。");
|
||||
break;
|
||||
case 1:
|
||||
for (var i=1;i<=150;i++) {
|
||||
core.removeLocalStorage("save"+i);
|
||||
}
|
||||
core.drawText("\t[操作成功]当前塔的存档已被清空。");
|
||||
core.removeLocalStorage("autoSave");
|
||||
break;
|
||||
case 2:
|
||||
core.status.event.selection=5;
|
||||
core.ui.drawSyncSave();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////// 存档删除界面时,按下某个键的操作 //////
|
||||
actions.prototype.keyDownStorageRemove = function (keycode) {
|
||||
if (keycode==38) {
|
||||
core.status.event.selection--;
|
||||
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||
}
|
||||
if (keycode==40) {
|
||||
core.status.event.selection++;
|
||||
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||
}
|
||||
}
|
||||
|
||||
////// 存档删除界面时,放开某个键的操作 //////
|
||||
actions.prototype.keyUpStorageRemove = function (keycode) {
|
||||
if (keycode==27 || keycode==88) {
|
||||
core.status.event.selection=5;
|
||||
core.ui.drawSyncSave();
|
||||
return;
|
||||
}
|
||||
var choices = core.status.event.ui.choices;
|
||||
if (keycode==13 || keycode==32 || keycode==67) {
|
||||
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||
this.clickStorageRemove(6, topIndex+core.status.event.selection);
|
||||
}
|
||||
}
|
||||
|
||||
////// “虚拟键盘”界面时的点击操作 //////
|
||||
actions.prototype.clickKeyBoard = function (x, y) {
|
||||
if (y==3 && x>=1 && x<=11) {
|
||||
|
||||
@ -170,6 +170,10 @@ enemys.prototype.getDefDamage = function (monsterId) {
|
||||
enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||
|
||||
var mon_hp = monster.hp, mon_atk = monster.atk, mon_def = monster.def, mon_special = monster.special;
|
||||
hero_hp=Math.max(0, hero_hp);
|
||||
hero_atk=Math.max(0, hero_atk);
|
||||
hero_def=Math.max(0, hero_def);
|
||||
hero_mdef=Math.max(0, hero_mdef);
|
||||
|
||||
if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross")) // 如果是无敌属性,且勇士未持有十字架
|
||||
return 999999999; // 返回无限大
|
||||
|
||||
@ -224,9 +224,9 @@ events.prototype.doAction = function() {
|
||||
|
||||
// 事件处理完毕
|
||||
if (core.status.event.data.list.length==0) {
|
||||
core.ui.closePanel();
|
||||
if (core.isset(core.status.event.data.callback))
|
||||
core.status.event.data.callback();
|
||||
core.ui.closePanel();
|
||||
core.replay();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1068,6 +1068,14 @@ ui.prototype.drawLocalSaveSelect = function () {
|
||||
]);
|
||||
}
|
||||
|
||||
////// 绘制存档删除页面 //////
|
||||
ui.prototype.drawStorageRemove = function () {
|
||||
core.status.event.id = 'storageRemove';
|
||||
this.drawChoices(null, [
|
||||
"清空全部塔的存档", "只清空当前塔的存档", "返回上级菜单"
|
||||
]);
|
||||
}
|
||||
|
||||
////// 绘制分页 //////
|
||||
ui.prototype.drawPagination = function (page, totalPage) {
|
||||
|
||||
|
||||
6
main.js
6
main.js
@ -442,8 +442,9 @@ main.dom.replayGame.onclick = function () {
|
||||
return;
|
||||
}
|
||||
if (core.isset(obj.version) && obj.version!=core.firstData.version) {
|
||||
alert("游戏版本不一致!");
|
||||
return;
|
||||
// alert("游戏版本不一致!");
|
||||
if (!confirm("游戏版本不一致!\n你仍然想播放录像吗?"))
|
||||
return;
|
||||
}
|
||||
if (!core.isset(obj.route) || !core.isset(obj.hard)) {
|
||||
alert("无效的录像!");
|
||||
@ -454,7 +455,6 @@ main.dom.replayGame.onclick = function () {
|
||||
core.resetStatus(core.firstData.hero, obj.hard, core.firstData.floorId, null, core.initStatus.maps);
|
||||
core.events.setInitData(obj.hard);
|
||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||
//core.setHeroMoveTriggerInterval();
|
||||
core.startReplay(core.decodeRoute(obj.route));
|
||||
}, true);
|
||||
}, function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user