From 09d95cc7776cfe537365ce7e3511f453d1311b82 Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 2 Dec 2018 22:05:24 +0800 Subject: [PATCH] Merge Settings --- docs/event.md | 2 +- libs/actions.js | 107 +++++++++++++++++++++++++++++++++++++++--------- libs/ui.js | 9 +++- 3 files changed, 96 insertions(+), 22 deletions(-) diff --git a/docs/event.md b/docs/event.md index 3b5cba46..b17c45e8 100644 --- a/docs/event.md +++ b/docs/event.md @@ -1550,7 +1550,7 @@ choices为一个数组,其中每一项都是一个选项列表。 ### waitAsync:等待所有异步事件执行完毕 -上面有很多很多的异步事件(也就执行时不等待执行完毕)。 +上面有很多很多的异步事件(也就是执行时不等待执行完毕)。 由于录像是加速播放,且会跳过`{"type":"sleep"}`(等待X毫秒)事件;因此异步行为很有可能导致录像播放出错。 diff --git a/libs/actions.js b/libs/actions.js index 6439e095..d4d21634 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -166,6 +166,9 @@ actions.prototype.keyDown = function(keyCode) { if (core.status.event.id=='replay') { this.keyDownReplay(keyCode); } + if (core.status.event.id=='gameInfo') { + this.keyDownGameInfo(keyCode); + } return; } if(!core.status.played) { @@ -280,6 +283,10 @@ actions.prototype.keyUp = function(keyCode, altKey) { this.keyUpReplay(keyCode); return; } + if (core.status.event.id=='gameInfo') { + this.keyUpGameInfo(keyCode); + return; + } if (core.status.event.id=='centerFly') { this.keyUpCenterFly(keyCode); return; @@ -590,6 +597,10 @@ actions.prototype.onclick = function (x, y, stepPostfix) { return; } + if (core.status.event.id=='gameInfo') { + this.clickGameInfo(x,y); + } + } ////// 滑动鼠标滚轮时的操作 ////// @@ -1903,25 +1914,10 @@ actions.prototype.clickSettings = function (x,y) { core.ui.drawSyncSave(); break; case 5: - core.ui.drawStatistics(); + core.status.event.selection=0; + core.ui.drawGameInfo(); break; case 6: - if (core.platform.isPC) { - window.open("/score.php?name="+core.firstData.name+"&num=10", "_blank"); - } - else { - if (confirm("即将离开本塔,跳转至本塔评论页面,确认?")) { - window.location.href = "/score.php?name="+core.firstData.name+"&num=10"; - } - } - break; - case 7: - core.ui.drawHelp(); - break; - case 8: - core.ui.drawAbout(); - break; - case 9: core.status.event.selection=1; core.ui.drawConfirmBox("你确定要返回标题页面吗?", function () { core.ui.closePanel(); @@ -1931,7 +1927,7 @@ actions.prototype.clickSettings = function (x,y) { core.ui.drawSettings(); }); break; - case 10: + case 7: core.ui.closePanel(); break; } @@ -2057,7 +2053,7 @@ actions.prototype.clickSyncSave = function (x,y) { core.ui.drawStorageRemove(); break; case 7: - core.status.event.selection=3; + core.status.event.selection=4; core.ui.drawSettings(); break; @@ -2291,7 +2287,7 @@ actions.prototype.clickStorageRemove = function (x, y) { } break; case 2: - core.status.event.selection=5; + core.status.event.selection=6; core.ui.drawSyncSave(); break; } @@ -2414,6 +2410,77 @@ actions.prototype.keyUpReplay = function (keycode) { } } + +////// 游戏信息界面时的点击操作 ////// +actions.prototype.clickGameInfo = 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=49 && keycode<=57) { + var index = keycode-49; + if (index=1 && x<=11) { diff --git a/libs/ui.js b/libs/ui.js index 40855e7e..ac5e4c93 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -919,7 +919,7 @@ ui.prototype.drawSettings = function () { core.status.event.id = 'settings'; this.drawChoices(null, [ - "系统设置", "虚拟键盘", "浏览地图", "绘图模式", "同步存档", "数据统计", "查看评论", "操作帮助", "关于本塔", "返回标题", "返回游戏" + "系统设置", "虚拟键盘", "浏览地图", "绘图模式", "同步存档", "游戏信息", "返回标题", "返回游戏" ]); } @@ -1315,6 +1315,13 @@ ui.prototype.drawReplay = function () { ]); } +ui.prototype.drawGameInfo = function () { + core.status.event.id = 'gameInfo'; + this.drawChoices(null, [ + "数据统计", "查看评论", "操作帮助", "关于本塔", "返回上级菜单" + ]); +} + ////// 绘制分页 ////// ui.prototype.drawPagination = function (page, totalPage, top) { // if (totalPage