diff --git a/README.md b/README.md index 8721c47f..690e8ee4 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! * [x] \r[red]可以动态调整剧情文本的颜色 * [x] 升级事件改用事件编辑器完成 * [x] 每层楼都增添该层的并行事件处理 -* [x] 新增快捷键:N返回标题;P查看评论;O打开工程 +* [x] 新增快捷键:N返回标题;P游戏主页;O打开工程 * [x] 新增事件:设置全局属性或全局数值 * [x] 新增事件:隐藏/显示状态栏 * [x] 道具可以设置是否在回放时绘制道具栏或直接使用 diff --git a/docs/element.md b/docs/element.md index ebec42ad..7fb34b35 100644 --- a/docs/element.md +++ b/docs/element.md @@ -473,7 +473,7 @@ HTML5魔塔一大亮点就是存在录像系统,可以很方便进行录像回 - **[G]** 打开/关闭楼层传送器 - **[A]** 读取自动存档 - **[S/D]** 打开/关闭存/读档页面 -- **[K/V]** 打开/关闭快捷商店选择列表 +- **[V]** 打开/关闭快捷商店选择列表 - **[T]** 打开/关闭工具栏 - **[Q]** 打开/关闭装备栏 - **[ESC]** 打开/关闭系统菜单 diff --git a/libs/actions.js b/libs/actions.js index bab6f53d..4dbcb71b 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -196,10 +196,14 @@ actions.prototype.keyUp = function(keyCode, altKey, fromReplay) { if (!fromReplay && core.isset(core.status.replay)&&core.status.replay.replaying &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + var ok = function (keycode) { + return keycode==27 || keycode==88 || keycode==13 || keycode==32 || keycode==67; + } + if (core.status.lockControl) { core.status.holdingKeys = []; // 全键盘操作部分 - if (core.status.event.id == 'text' && (keyCode==13 || keyCode==32 || keyCode==67)) { + if (core.status.event.id == 'text' && ok(keyCode)) { core.drawText(); return; } @@ -211,15 +215,19 @@ actions.prototype.keyUp = function(keyCode, altKey, fromReplay) { this.keyUpAction(keyCode); return; } - if (core.status.event.id=='about' && (keyCode==13 || keyCode==32 || keyCode==67)) { + if (core.status.event.id=='about' && ok(keyCode)) { this.clickAbout(); return; } + if (core.status.event.id=='help' && ok(keyCode)) { + core.ui.closePanel(); + return; + } if (core.status.event.id=='book') { this.keyUpBook(keyCode); return; } - if (core.status.event.id=='book-detail' && (keyCode==13 || keyCode==32 || keyCode==67)) { + if (core.status.event.id=='book-detail' && ok(keyCode)) { this.clickBookDetail(); return; } @@ -251,8 +259,8 @@ actions.prototype.keyUp = function(keyCode, altKey, fromReplay) { this.keyUpSL(keyCode); return; } - if (core.status.event.id == 'keyBoard') { - this.keyUpKeyBoard(keyCode); + if (core.status.event.id == 'keyBoard' && ok(keyCode)) { + core.ui.closePanel(); return; } if (core.status.event.id=='switchs') { @@ -555,6 +563,11 @@ actions.prototype.onclick = function (x, y, stepPostfix) { this.clickAbout(x,y); return; } + + if (core.status.event.id == 'help') { + this.clickHelp(x,y); + return; + } if (core.status.event.id == 'action') { this.clickAction(x,y); @@ -2550,14 +2563,6 @@ actions.prototype.clickKeyBoard = function (x, y) { core.ui.closePanel(); } -////// “虚拟键盘”界面时的点击操作 ////// -actions.prototype.keyUpKeyBoard = function (keycode) { - if (keycode==27 || keycode==88 || keycode==13 || keycode==32 || keycode==67) { - core.ui.closePanel(); - return; - } -} - ////// 光标界面时的点击操作 ////// actions.prototype.clickCursor = function (x,y) { @@ -2616,6 +2621,10 @@ actions.prototype.clickAbout = function () { core.restart(true); } +////// “帮助”界面时的点击操作 ////// +actions.prototype.clickHelp = function () { + core.ui.closePanel(); +} ////// 绘图相关 ////// diff --git a/libs/control.js b/libs/control.js index 9d7a412e..9c16cf3c 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1374,6 +1374,22 @@ control.prototype.setFg = function(color, time, callback) { core.animateFrame.asyncId[changeAnimate] = true; } +////// 画面闪烁 ////// +control.prototype.screenFlash = function (color, time, times, callback) { + times = times || 1; + time = time/3; + var nowColor = core.clone(core.status.curtainColor); + core.setFg(color, time, function() { + core.setFg(nowColor, time * 2, function() { + if (times > 1) + core.screenFlash(color, time * 3, times - 1, callback); + else { + if (core.isset(callback)) callback(); + } + }); + }); +} + ////// 更新全地图显伤 ////// control.prototype.updateDamage = function (floorId, canvas) { floorId = floorId || core.status.floorId; diff --git a/libs/core.js b/libs/core.js index 87a51ea2..a77b8c06 100644 --- a/libs/core.js +++ b/libs/core.js @@ -343,6 +343,12 @@ core.prototype.init = function (coreData, callback) { } core.animateFrame.weather.fog.src = "project/images/fog.png"; + core.material.images.keyboard = new Image(); + core.material.images.keyboard.onerror = function () { + core.material.images.keyboard = null; + } + core.material.images.keyboard.src = "project/images/keyboard.png"; + core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d'); core.loader.load(function () { @@ -923,7 +929,7 @@ core.prototype.setFg = function(color, time, callback) { ////// 画面闪烁 ////// core.prototype.screenFlash = function (color, time, times, callback) { - core.ui.screenFlash(color, time, times, callback); + core.control.screenFlash(color, time, times, callback); } ////// 更新全地图显伤 ////// diff --git a/libs/ui.js b/libs/ui.js index 9a0e3c71..60d5303a 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1485,7 +1485,7 @@ ui.prototype.drawReplay = function () { ui.prototype.drawGameInfo = function () { core.status.event.id = 'gameInfo'; this.drawChoices(null, [ - "数据统计", "查看工程", "查看评论", "操作帮助", "关于本塔","下载离线版本", "返回主菜单" + "数据统计", "查看工程", "游戏主页", "操作帮助", "关于本塔","下载离线版本", "返回主菜单" ]); } @@ -2805,46 +2805,39 @@ ui.prototype.drawPaint = function () { ////// 绘制帮助页面 ////// ui.prototype.drawHelp = function () { - core.drawText([ - "\t[键盘快捷键列表]"+ - "[CTRL] 跳过对话 [Z] 转向\n" + - "[X] 怪物手册 [G] 楼层传送\n" + - "[A] 读取自动存档 [S/D] 存读档页面\n" + - "[K/V] 快捷商店 [ESC] 系统菜单\n" + - "[T] 道具页面 [Q] 装备页面\n" + - "[B] 数据统计 [H] 帮助页面\n" + - "[R] 回放录像 [E] 显示光标\n" + - "[SPACE] 轻按 [M] 绘图模式\n" + - "[N] 返回标题页面 [P] 查看评论区\n" + - "[O] 查看工程 [F7] 打开debug穿墙模式\n" + - "[PgUp/PgDn] 浏览地图\n"+ - "[1~4] 快捷使用破炸飞和其他道具\n"+ - "[Alt+0~9] 快捷换装", - "\t[鼠标操作]"+ - "点状态栏中图标: 进行对应的操作\n"+ - "点任意块: 寻路并移动\n"+ - "点任意块并拖动: 指定寻路路线\n"+ - "双击空地: 瞬间移动\n"+ - "单击勇士: 转向\n"+ - "双击勇士: 轻按(仅在轻按开关打开时有效)\n"+ - "长按任意位置:跳过剧情对话或打开虚拟键盘" - ]); -} - -////// 画面闪烁 ////// -ui.prototype.screenFlash = function (color, time, times, callback) { - times = times || 1; - time = time/3; - var nowColor = core.clone(core.status.curtainColor); - core.setFg(color, time, function() { - core.setFg(nowColor, time * 2, function() { - if (times > 1) - core.screenFlash(color, time * 3, times - 1, callback); - else { - if (core.isset(callback)) callback(); - } - }); - }); + core.clearLastEvent(); + if (core.material.images.keyboard) { + core.status.event.id = 'help'; + core.lockControl(); + core.setAlpha('ui', 1); + core.drawImage('ui', core.material.images.keyboard, 0, 0); + } + else { + core.drawText([ + "\t[键盘快捷键列表]"+ + "[CTRL] 跳过对话 [Z] 转向\n" + + "[X] 怪物手册 [G] 楼层传送\n" + + "[A] 读取自动存档 [S/D] 存读档页面\n" + + "[V] 快捷商店 [ESC] 系统菜单\n" + + "[T] 道具页面 [Q] 装备页面\n" + + "[B] 数据统计 [H] 帮助页面\n" + + "[R] 回放录像 [E] 显示光标\n" + + "[SPACE] 轻按 [M] 绘图模式\n" + + "[N] 返回标题页面 [P] 游戏主页\n" + + "[O] 查看工程 [F7] 打开debug穿墙模式\n" + + "[PgUp/PgDn] 浏览地图\n"+ + "[1~4] 快捷使用破炸飞和其他道具\n"+ + "[Alt+0~9] 快捷换装", + "\t[鼠标操作]"+ + "点状态栏中图标: 进行对应的操作\n"+ + "点任意块: 寻路并移动\n"+ + "点任意块并拖动: 指定寻路路线\n"+ + "双击空地: 瞬间移动\n"+ + "单击勇士: 转向\n"+ + "双击勇士: 轻按(仅在轻按开关打开时有效)\n"+ + "长按任意位置:跳过剧情对话或打开虚拟键盘" + ]); + } } ////// 动态canvas ////// diff --git a/project/functions.js b/project/functions.js index 83c5ddd4..4e14869f 100644 --- a/project/functions.js +++ b/project/functions.js @@ -703,7 +703,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = case 90: // Z:转向 core.turnHero(); break; - case 75: case 86: // K/V:打开快捷商店列表 + case 86: // V:打开快捷商店列表 core.openQuickShop(true); break; case 32: // SPACE:轻按 @@ -741,7 +741,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = case 79: // O:查看工程 window.open(core.platform.isPC?"editor.html":"editor-mobile.html", "_blank"); break; - case 80: // P:查看评论 + case 80: // P:游戏主页 window.open("/score.php?name="+core.firstData.name+"&num=10", "_blank"); break; case 49: // 快捷键1: 破 diff --git a/project/images/keyboard.png b/project/images/keyboard.png new file mode 100644 index 00000000..c2b9d241 Binary files /dev/null and b/project/images/keyboard.png differ diff --git a/更新说明.txt b/更新说明.txt index 443b2ae6..7a3f902a 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -7,7 +7,7 @@ \r[red]可以动态调整剧情文本的颜色 升级事件改用事件编辑器完成 每层楼都增添该层的并行事件处理 -新增快捷键:N返回标题;P查看评论;O打开工程 +新增快捷键:N返回标题;P游戏主页;O打开工程 新增事件:设置全局属性或全局数值 新增事件:隐藏/显示状态栏 道具可以设置是否在回放时绘制道具栏或直接使用