Merge Settings

This commit is contained in:
oc 2018-12-02 22:05:24 +08:00
parent a830e14614
commit 09d95cc777
3 changed files with 96 additions and 22 deletions

View File

@ -1550,7 +1550,7 @@ choices为一个数组其中每一项都是一个选项列表。
### waitAsync等待所有异步事件执行完毕
上面有很多很多的异步事件(也就执行时不等待执行完毕)。
上面有很多很多的异步事件(也就执行时不等待执行完毕)。
由于录像是加速播放,且会跳过`{"type":"sleep"}`等待X毫秒事件因此异步行为很有可能导致录像播放出错。

View File

@ -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<topIndex+choices.length) {
var selection = y - topIndex;
switch (selection) {
case 0:
core.ui.drawStatistics();
break;
case 1:
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 2:
core.ui.drawHelp();
break;
case 3:
core.ui.drawAbout();
break;
case 4:
core.status.event.selection=5;
core.ui.drawSettings();
break;
}
}
}
////// 游戏信息界面时,按下某个键的操作 //////
actions.prototype.keyDownGameInfo = 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.keyUpGameInfo = function (keycode) {
if (keycode==27 || keycode==88) {
core.ui.closePanel();
return;
}
var choices = core.status.event.ui.choices;
if (keycode==13 || keycode==32 || keycode==67) {
var topIndex = 6 - parseInt((choices.length - 1) / 2);
this.clickGameInfo(6, topIndex+core.status.event.selection);
}
// 数字键快速选择
if (keycode>=49 && keycode<=57) {
var index = keycode-49;
if (index<choices.length) {
var topIndex = 6 - parseInt((choices.length - 1) / 2);
this.clickGameInfo(6, topIndex+index);
}
}
}
////// “虚拟键盘”界面时的点击操作 //////
actions.prototype.clickKeyBoard = function (x, y) {
if (y==3 && x>=1 && x<=11) {

View File

@ -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<page) totalPage=page;