diff --git a/README.md b/README.md index b81aa04b..da2183a4 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,24 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! ## 更新说明 +### 2019.4.13 V2.6 + +* [x] 拆分整个项目,大幅重构代码,新增大量API +* [x] 重写文档,尤其是脚本和API列表 +* [x] 现在可以对编辑器的表格的结构进行配置 +* [x] 可以收藏和高亮存档 +* [x] 独立出来的插件编写 +* [x] 新增事件:关门、显示确认框、后置循环处理 +* [x] 剧情文本的绘制可以设置居中选项 +* [x] 选项框的绘制可以增加图标 +* [x] 增加公共事件版的全局商店 +* [x] 公共事件现在可以传入参数 +* [x] 重写滑冰事件,现在滑冰在背景层了 +* [x] 将输入框改成自定义实现,避免部分设备不支持 +* [x] 状态栏文字可以自动放缩 +* [x] 显示图片和对话框立绘可以裁剪图片 +* [x] 修复所有已知bug,大量细节优化 + ### 2019.2.19 V2.5.5 * [x] 现在编辑器修改地图后可以直接读档生效,无需再重置地图或回放录像 diff --git a/_docs/api.md b/_docs/api.md index 54e8b916..2f167244 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -1464,6 +1464,7 @@ posX, posY:素材在该素材图片上的位置;height:素材的高度;f core.searchBlock(id, floorId, showDisable) 搜索一个图块出现过的所有位置。id为图块ID,也可以传入图块的数字。 +id支持通配符搜索,比如"*Door"可以搜索所有的门,"unknownEvent*"可以所有所有的unknownEvent。 floorId为要搜索的楼层,可以是一个楼层ID,或者一个楼层数组。如果floorId不填则只搜索当前楼层。 showDisable如果为真,则对于禁用的图块也会返回。 此函数将返回一个数组,每一项为一个搜索到的结果: @@ -1997,6 +1998,10 @@ core.reverseDirection(direction) 翻转方向,即"up"转成"down", "left"转成"right"等。 +core.matchWildcard(pattern, string) +进行通配符的匹配判定,目前仅支持*(可匹配0或任意个字符)。比如"a*b*c"可以匹配"aa012bc"。 + + core.encodeBase64(str) / core.decodeBase64(str) 将字符串进行base64加密或解密。 diff --git a/_docs/event.md b/_docs/event.md index e5a2b7b9..c68f267c 100644 --- a/_docs/event.md +++ b/_docs/event.md @@ -655,8 +655,9 @@ revisit常常使用在一些商人之类的地方,当用户购买物品后不 ``` js [ {"type": "setBlock", "floorId": "MT1", "loc": [3,3], "number": 233}, // 将MT1层的(3,3)点变成数字233 - {"type": "setBlock", "loc": [2,1], "number": 121}, // 省略floorId则默认为本层 + {"type": "setBlock", "loc": [2,1],setVa "number": 121}, // 省略floorId则默认为本层 {"type": "setBlock", "number": 57}, // loc也可省略,默认为当前点 + {"type": "setBlock", "number": "yellowDoor"}, // 从V2.6开始也允许写图块ID ] ``` @@ -666,6 +667,8 @@ loc为可选的,表示要更改地图块的坐标。如果忽略此项,则 number为**要更改到的数字**,有关“数字”的定义详见参见[素材的机制](personalization#素材的机制)。 +从V2.6开始,number也允许写图块的ID,将自动转成对应的数字。 + 图块更改后: - 其启用/禁用状态不会发生任何改变。原来是启用还是启用,原来是禁用还是禁用。 @@ -1642,7 +1645,7 @@ default可选,如果为true则显示选择项时默认选中【确定】,否 yes和no均为必填项,即用户点击确认或取消后执行的事件。 -### while:循环处理 +### while:前置条件循环 从2.2.1样板开始,我们提供了循环处理(while事件)。 @@ -1678,6 +1681,12 @@ yes和no均为必填项,即用户点击确认或取消后执行的事件。 ] ``` +### dowhile:后置条件循环 + +`type:dowhile`可以制作一个后置条件循环。 + +其写法与参数和`type:while`完全一致,不过与其不同的是,会先执行一次事件列表,再对条件进行判定,就和C/C++中的 `do {...} while (...);` 语法一样。 + ### break:跳出循环 使用 `{"type": "break"}` 可以跳出当前循环。 diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index a8741045..4f38fe1e 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -327,6 +327,7 @@ action | if_1_s | switch_s | while_s + | dowhile_s | break_s | continue_s | input_s @@ -728,20 +729,20 @@ return code; */; setBlock_s - : '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline + : '转变图块为' EvalString 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline /* setBlock_s tooltip : setBlock:设置某个图块,忽略坐标楼层则为当前事件 helpUrl : https://h5mota.com/games/template/docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97 colour : this.dataColor -default : [0,"","",""] +default : ["yellowDoor","","",""] var floorstr = ''; if (PosString_0 && PosString_1) { floorstr = ', "loc": ['+PosString_0+','+PosString_1+']'; } IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n'; +var code = '{"type": "setBlock", "number": "'+EvalString_0+'"'+floorstr+IdString_0+'},\n'; return code; */; @@ -870,20 +871,20 @@ return code; */; setBgFgBlock_s - : '转变图层块' Bg_Fg_List '为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline + : '转变图层块' Bg_Fg_List '为' EvalString 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline /* setBgFgBlock_s tooltip : setBgFgBlock:设置某个图层块,忽略坐标楼层则为当前点 helpUrl : https://h5mota.com/games/template/docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97 colour : this.dataColor -default : ["bg",0,"","",""] +default : ["bg","yellowDoor","","",""] var floorstr = ''; if (PosString_0 && PosString_1) { floorstr = ', "loc": ['+PosString_0+','+PosString_1+']'; } IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -var code = '{"type": "setBgFgBlock", "name": "' + Bg_Fg_List_0 + '", "number":'+Int_0+floorstr+IdString_0+'},\n'; +var code = '{"type": "setBgFgBlock", "name": "' + Bg_Fg_List_0 + '", "number": "'+EvalString_0+'"'+floorstr+IdString_0+'},\n'; return code; */; @@ -1693,11 +1694,11 @@ return code; */; while_s - : '循环处理' ':' '当' expression '时' BGNL? Newline action+ BEND Newline + : '前置条件循环' ':' '当' expression '时' BGNL? Newline action+ BEND Newline /* while_s -tooltip : while:循环处理 -helpUrl : https://h5mota.com/games/template/docs/#/event?id=while%EF%BC%9A%E5%BE%AA%E7%8E%AF%E5%A4%84%E7%90%86 +tooltip : while:前置条件循环 +helpUrl : https://h5mota.com/games/template/docs/#/event?id=while%ef%bc%9a%e5%89%8d%e7%bd%ae%e6%9d%a1%e4%bb%b6%e5%be%aa%e7%8e%af colour : this.eventColor var code = ['{"type": "while", "condition": "',expression_0,'",\n', '"data": [\n',action_0,'],\n', @@ -1705,6 +1706,19 @@ var code = ['{"type": "while", "condition": "',expression_0,'",\n', return code; */; +dowhile_s + : '后置条件循环' ':' BGNL? Newline action+ BEND '当' expression '时' Newline + +/* dowhile_s +tooltip : dowhile:后置条件循环 +helpUrl : https://h5mota.com/games/template/docs/#/event?id=dowhile%ef%bc%9a%e5%90%8e%e7%bd%ae%e6%9d%a1%e4%bb%b6%e5%be%aa%e7%8e%af +colour : this.eventColor +var code = ['{"type": "dowhile", "condition": "',expression_0,'",\n', + '"data": [\n',action_0,'],\n', +'},\n'].join(''); +return code; +*/; + break_s : '跳出循环' Newline @@ -2021,8 +2035,8 @@ Global_Value_List Global_Flag_List - : '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示魔力值'|'显示魔防值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'开启加点'|'开启负伤'|'仇恨怪战后扣减一半'|'夹击是否上整'|'循环计算临界'|'允许轻按'|'寻路算法不绕血瓶'|'允许走到将死领域'|'允许瞬间移动'|'允许查看禁用商店'|'阻激夹域后禁用快捷商店'|'检查控制台' - /*Global_Flag_List ['enableFloor','enableName','enableLv', 'enableHPMax', 'enableMana', 'enableMDef', 'enableMoney', 'enableExperience', 'enableLevelUp', 'levelUpLeftMode', 'enableKeys', 'enablePZF', 'enableDebuff', 'enableSkill', 'flyNearStair', 'enableAddPoint', 'enableNegativeDamage', 'hatredDecrease', 'betweenAttackCeil', 'useLoop', 'enableGentleClick', 'potionWhileRouting', 'canGoDeadZone', 'enableMoveDirectly', 'enableDisabledShop', 'disableShopOnDamage', 'checkConsole']*/; + : '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示魔力值'|'显示魔防值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'破墙镐四方向'|'炸弹四方向'|'冰冻徽章四方向'|'铁门不需要钥匙'|'开启加点'|'开启负伤'|'仇恨怪战后扣减一半'|'夹击是否上整'|'循环计算临界'|'允许轻按'|'寻路算法不绕血瓶'|'允许走到将死领域'|'允许瞬间移动'|'允许查看禁用商店'|'阻激夹域后禁用快捷商店'|'检查控制台' + /*Global_Flag_List ['enableFloor','enableName','enableLv', 'enableHPMax', 'enableMana', 'enableMDef', 'enableMoney', 'enableExperience', 'enableLevelUp', 'levelUpLeftMode', 'enableKeys', 'enablePZF', 'enableDebuff', 'enableSkill', 'flyNearStair', 'pickaxeFourDirections', 'bombFourDirections', 'snowFourDirections', 'steelDoorWithoutKey', 'enableAddPoint', 'enableNegativeDamage', 'hatredDecrease', 'betweenAttackCeil', 'useLoop', 'enableGentleClick', 'potionWhileRouting', 'canGoDeadZone', 'enableMoveDirectly', 'enableDisabledShop', 'disableShopOnDamage', 'checkConsole']*/; Colour : 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则 @@ -2639,13 +2653,20 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['choices_s'].xmlText([ this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]); break; - case "while": // 循环处理 + case "while": // 前置条件循环处理 this.next = MotaActionBlocks['while_s'].xmlText([ // MotaActionBlocks['evalString_e'].xmlText([data.condition]), this.tryToUseEvFlag_e('evalString_e', [data.condition]), this.insertActionList(data["data"]), this.next]); break; + case "dowhile": // 后置条件循环处理 + this.next = MotaActionBlocks['dowhile_s'].xmlText([ + this.insertActionList(data["data"]), + // MotaActionBlocks['evalString_e'].xmlText([data.condition]), + this.tryToUseEvFlag_e('evalString_e', [data.condition]), + this.next]); + break; case "break": // 跳出循环 this.next = MotaActionBlocks['break_s'].xmlText([ this.next]); diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 2a641312..90bf5962 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -68,6 +68,7 @@ editor_blockly = function () { MotaActionBlocks['tip_s'].xmlText(), MotaActionBlocks['win_s'].xmlText(), MotaActionBlocks['lose_s'].xmlText(), + MotaActionBlocks['confirm_s'].xmlText(), MotaActionBlocks['choices_s'].xmlText([ '选择剑或者盾','流浪者','man',MotaActionBlocks['choicesContext'].xmlText([ '剑','','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]), @@ -76,7 +77,6 @@ editor_blockly = function () { ]) ]) ]), - MotaActionBlocks['confirm_s'].xmlText(), ], '数据相关':[ MotaActionBlocks['setValue_s'].xmlText([ @@ -118,6 +118,7 @@ editor_blockly = function () { {"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行default事件"}]}, ]}), MotaActionBlocks['while_s'].xmlText(), + MotaActionBlocks['dowhile_s'].xmlText(), MotaActionBlocks['break_s'].xmlText(), MotaActionBlocks['continue_s'].xmlText(), MotaActionBlocks['revisit_s'].xmlText(), diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index 026ab732..8389ffd6 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -536,6 +536,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_bool": "bool", "_data": "如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙" }, + "steelDoorWithoutKey": { + "_left": true, + "_type": "checkbox", + "_bool": "bool", + "_data": "铁门是否不需要钥匙开启。如果此项为true,则无需钥匙也可以开铁门。" + }, "equipment": { "_leaf": true, "_type": "checkbox", @@ -548,6 +554,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_bool": "bool", "_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮" }, + "iconInEquipbox": { + "_leaf": true, + "_type": "checkbox", + "_bool": "bool", + "_data": "在装备栏中的属性变化,是否绘制图标;如果此项开启,则会绘制图标而不是文字" + }, "enableAddPoint": { "_leaf": true, "_type": "checkbox", diff --git a/editor-mobile.html b/editor-mobile.html index e77a286f..0e4fde1f 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -120,7 +120,7 @@