diff --git a/.idea/mota-js.iml b/.idea/mota-js.xml similarity index 100% rename from .idea/mota-js.iml rename to .idea/mota-js.xml diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..e145e12f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2018, Zhang Chen +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index db47a83d..66428b22 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,12 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! ## 更新说明 +### 2018.1.12 V1.3.1 + +* [x] 增加虚拟键盘 +* [x] 增加自动存档(回退),A键可快速读档 +* [x] 修复几处较为严重的Bug + ### 2018.1.1 V1.3 * [x] 支持全键盘操作。 diff --git a/_server/css/editor.css b/_server/css/editor.css index 4021a028..eb70fd55 100644 --- a/_server/css/editor.css +++ b/_server/css/editor.css @@ -47,6 +47,7 @@ body{ white-space: pre; border: 1px solid #ddd; border-radius: 2px; + overflow: auto; } #editTip{ position: absolute; diff --git a/_server/vm.js b/_server/vm.js index 4f554a68..35412a2d 100644 --- a/_server/vm.js +++ b/_server/vm.js @@ -31,7 +31,7 @@ var exportM = new Vue({ filestr += ']'+(yy==12?'':',\n'); } pout.value = filestr; - editArea.mapArr = filestr; + // editArea.mapArr = filestr; editArea.error = 0; tip.whichShow = 2; } @@ -56,7 +56,7 @@ var editArea = new Vue({ if(val=='') return; if(that.formatArr()){ that.error = 0; - clearTimeout(that.formatTimer); + setTimeout(function(){ that.mapArr = that.formatArr(); that.drawMap(); @@ -98,7 +98,8 @@ var editArea = new Vue({ }, formatArr: function(){ var formatArrStr = ''; - + var that = this; + clearTimeout(that.formatTimer); if(this.mapArr.split(/\D+/).join(' ').trim().split(' ').length != 169) return false; var arr = this.mapArr.replace(/\s+/g, '').split('],['); diff --git a/docs/api.md b/docs/api.md index ebd28f99..092ad862 100644 --- a/docs/api.md +++ b/docs/api.md @@ -93,6 +93,7 @@ core.setAutoHeroMove // 设置勇士的自动行走路线 core.autoHeroMove // 让勇士开始自动行走 core.setHeroMoveInterval // 设置行走的效果动画 core.setHeroMoveTriggerInterval // 设置勇士行走过程中对事件的触发检测 +core.moveAction // 实际每一步的行走过程 * core.turnHero(direction) // 设置勇士的方向(转向) core.canMoveHero // 勇士能否前往某方向 core.moveHero // 让勇士开始移动 @@ -178,16 +179,21 @@ core.clone // 深拷贝一个对象 core.formatDate // 格式化时间为字符串 core.setTwoDigits // 两位数显示 core.debug // 进入Debug模式,攻防血和钥匙都调成很高的数值 +core.replay // 开始回放 core.checkStatus // 判断当前能否进入某个事件 core.openBook // 点击怪物手册时的打开操作 core.useFly // 点击楼层传送器时的打开操作 core.openToolbox // 点击工具栏时的打开操作 +core.openQuickShop // 点击快捷商店时的打开操作 core.save // 点击保存按钮时的打开操作 core.load // 点击读取按钮时的打开操作 +core.openSettings // 点击设置按钮时的打开操作 core.doSL // 实际进行存读档事件 core.syncSave // 存档同步操作 core.saveData // 存档到本地 core.loadData // 从本地读档 +core.encodeRoute // 将路线压缩 +core.decodeRoute // 将路线解压缩 * core.setStatus // 设置勇士属性 * core.getStatus // 获得勇士属性 core.getLvName // 获得某个等级的名称 @@ -260,6 +266,7 @@ core.events.changeLight // 改变亮灯(感叹号)的事件 * core.events.afterLoadData // 读档事件后,载入事件前,可以执行的操作 // ------ 点击事件和键盘事件的处理 ------ +core.events.longClick // 长按 core.events.keyDownCtrl // 按下Ctrl键时(快捷跳过对话) core.events.clickConfirmBox // 确认框界面时的点击操作 core.events.keyUpConfirmBox // 确认框界面时,放开某个键的操作 @@ -295,6 +302,7 @@ core.events.keyUpSettings // 系统菜单栏界面时,放开某个键的操作 core.events.clickSyncSave // 同步存档界面时的点击操作 core.events.keyDownSyncSave // 同步存档界面时,按下某个键的操作 core.events.keyUpSyncSave // 同步存档界面时,放开某个键的操作 +core.events.clickKeyBoard // 虚拟键盘界面时的点击操作 core.events.clickAbout // “关于”界面时的点击操作 ``` diff --git a/docs/element.md b/docs/element.md index ef764af5..21df84a9 100644 --- a/docs/element.md +++ b/docs/element.md @@ -142,10 +142,6 @@ floorId指定的是目标楼层的唯一标识符(ID)。 可以指定time,指定后切换动画时长为指定的数值。 -楼梯和传送门默认可`"穿透"`。所谓穿透,就是当寻路穿过一个楼梯/传送门后,不会触发楼层传送事件,而是继续前进。通过系统Flag可以指定是否穿透,你也可以对每个传送点单独设置该项。 - -![楼层转换穿透](./img/floorset.png) - ## 背景音乐 本塔支持BGM和SE的播放。 @@ -190,12 +186,14 @@ this.sounds = [ // 在此存放所有的SE,和文件名一致 - **点任意块并拖动:** 指定寻路路线 - **单击勇士:** 转向 - **双击勇士:** 轻按(仅在轻按开关打开时有效) +- **长按任意位置:** 打开虚拟键盘 键盘操作快捷键如下: - **[CTRL]** 跳过对话 - **[X]** 打开/关闭怪物手册 - **[G]** 打开/关闭楼层传送器 +- **[A]** 读取自动存档 - **[S/D]** 打开/关闭存/读档页面 - **[K]** 打开/关闭快捷商店选择列表 - **[T]** 打开/关闭工具栏 diff --git a/docs/event.md b/docs/event.md index 58d0917e..a694f731 100644 --- a/docs/event.md +++ b/docs/event.md @@ -465,6 +465,8 @@ direction为可选的,指定的话将使勇士的朝向变成该方向 time为可选的,指定的话将作为楼层切换动画的时间。 +**time也可以置为0,如果为0则没有楼层切换动画。** + !> **changeFloor到达一个新的楼层,将不会执行firstArrive事件!如有需求请在到达点设置自定义事件,然后使用type: trigger立刻调用之。** ### changePos: 当前位置切换/勇士转向 @@ -844,8 +846,9 @@ events.prototype.addPoint = function (enemy) { 全局商店定义在`data.js`中,找到shops一项。 ``` js -"shops": { // 定义全局商店(即快捷商店) - "moneyShop1": { // 商店唯一ID +"shops": [ // 定义全局商店(即快捷商店) + { + "id": "moneyShop1", // 商店唯一ID "name": "贪婪之神", // 商店名称(标题) "icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 "textInList": "1F金币商店", // 在快捷商店栏中显示的名称 @@ -870,7 +873,8 @@ events.prototype.addPoint = function (enemy) { // "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍 ] }, - "expShop1": { // 商店唯一ID + { + "id": "expShop1", // 商店唯一ID "name": "经验之神", "icon": "pinkShop", "textInList": "1F经验商店", @@ -885,15 +889,15 @@ events.prototype.addPoint = function (enemy) { {"text": "攻击+5", "need": "30", "effect": "status:atk+=5"}, {"text": "防御+5", "need": "30", "effect": "status:def+=5"}, ] - }, -}, + } +], ``` -全局商店全部定义在`data.js`中的shops一项里。 -每个全局商店有一个唯一标识符(ID),然后是一系列对该商店的定义。 +全局商店全部定义在`data.js`中的shops一项里。商店以数组形式存放,每一个商店都是其中的一个对象。 +- id 为商店的唯一标识符(ID),请确保任何两个商店的id都不相同 - name 为商店的名称(打开商店后的标题) -- icon 为商店的图标,blueShop为蓝色商店,pinkShop为粉色商店 +- icon 为商店的图标,在icons.js的npcs中定义。如woman可代表一个商人。 - textInList 为其在快捷商店栏中显示的名称,如"3楼金币商店"等 - use 为消耗的类型,是金币(money)还是经验(experience)。 - need 是一个表达式,计算商店所需要用到的数值。 diff --git a/drawMapGUI.html b/drawMapGUI.html index 6a8f39ec..2a32d6c4 100644 --- a/drawMapGUI.html +++ b/drawMapGUI.html @@ -663,7 +663,7 @@ editor.info var editor = new editor(); editor.init(); editor.fs=fs; -editor.file=editor_file; +// editor.file=editor_file;