diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 8eb700d1..5e58167f 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -183,6 +183,18 @@ var code = '[\n'+action_0+']\n'; return code; */; +//eachArrive 事件编辑器入口之一 +eachArrive_m + : '每次到达楼层' BGNL? Newline action+ BEND + + +/* eachArrive_m +tooltip : 每次到达楼层 +helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6 +var code = '[\n'+action_0+']\n'; +return code; +*/; + //changeFloor 事件编辑器入口之一 changeFloor_m : '楼梯, 传送门' BGNL? Newline Floor_List IdString? Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND diff --git a/_server/comment.js b/_server/comment.js index 2cdc9364..2b7fcc33 100644 --- a/_server/comment.js +++ b/_server/comment.js @@ -330,6 +330,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_event": "firstArrive", "_data": "第一次到该楼层触发的事件,可以双击进入事件编辑器。" }, + "eachArrive": { + "_leaf": true, + "_type": "event", + "_event": "eachArrive", + "_data": "每次到该楼层触发的事件,可以双击进入事件编辑器;该事件会比firstArrive先执行。" + }, "parallelDo": { "_leaf": true, "_type": "textarea", diff --git a/_server/editor.js b/_server/editor.js index 7b418d1d..9bd90184 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -183,6 +183,7 @@ editor.prototype.mapInit = function () { editor.currentFloorData.fgmap = editor.fgmap; editor.currentFloorData.bgmap = editor.bgmap; editor.currentFloorData.firstArrive = []; + editor.currentFloorData.eachArrive = []; editor.currentFloorData.events = {}; editor.currentFloorData.changeFloor = {}; editor.currentFloorData.afterBattle = {}; diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 2ea9e2bb..2d81a4cc 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -52,6 +52,7 @@ editor_blockly = function () { MotaActionBlocks['afterGetItem_m'].xmlText(), MotaActionBlocks['afterOpenDoor_m'].xmlText(), MotaActionBlocks['firstArrive_m'].xmlText(), + MotaActionBlocks['eachArrive_m'].xmlText(), MotaActionBlocks['level_m'].xmlText(), ], '显示文字':[ diff --git a/_server/editor_file.js b/_server/editor_file.js index 68d9c8ec..3e938917 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -156,6 +156,7 @@ editor_file = function (editor, callback) { color: saveStatus?currData.color:null, weather: saveStatus?currData.weather:null, firstArrive: [], + eachArrive: [], parallelDo: "", events: {}, changeFloor: {}, diff --git a/docs/event.md b/docs/event.md index b17c45e8..686891a6 100644 --- a/docs/event.md +++ b/docs/event.md @@ -228,7 +228,7 @@ 除此以外,我们还能实现“对话框效果”,只要有`\b[...]`就可以。 - `\b[up]` 直接显示在当前点上方。同样把这里的up换成down则为下方。 - - 如果不存在当前点(如在firstArrive中调用),则显示在屏幕最上方(最下方) + - 如果不存在当前点(如在firstArrive或eachArrive中调用),则显示在屏幕最上方(最下方) - `\b[up,hero]` 显示在勇士上方。同样把这里的up换成down则为下方。 - `\b[up,x,y]` 显示在(x,y)点的上方(下方);x和y都为整数且在0到12之间。 @@ -807,8 +807,6 @@ time为可选的,指定的话将作为楼层切换动画的时间。 **如果time指定为小于100,则视为没有楼层切换动画。** -!> **changeFloor到达一个新的楼层,将不会执行firstArrive事件!如有需求请在到达点设置自定义事件,然后使用type: trigger立刻调用之。** - ### changePos:当前位置切换/勇士转向 有时候我们不想要楼层切换的动画效果,而是直接让勇士从A点到B点。 diff --git a/editor-mobile.html b/editor-mobile.html index 9141fe2d..04682f39 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -174,6 +174,7 @@ + diff --git a/editor.html b/editor.html index 41e3e25c..d85a793c 100644 --- a/editor.html +++ b/editor.html @@ -173,6 +173,7 @@ + diff --git a/project/functions.js b/project/functions.js index c6ee7084..350d5a04 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1,4 +1,4 @@ -var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = +var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { "events": { "initGame": function() { @@ -93,6 +93,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = visited.push(floorId); core.setFlag("__visited__", visited); } + // 每次抵达楼层时执行的事件 + if (!fromLoad) { + core.insertAction(core.floors[floorId].eachArrive); + } }, "addPoint": function (enemy) { // 加点事件