diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 79b11511..1bf93de3 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -26,6 +26,27 @@ return code; */; +//自动事件 事件编辑器入口之一 +autoEvent_m + : '自动事件' BGNL? Newline '触发条件' EvalString '优先级' Int BGNL? Newline '仅在本层检测' Bool '延迟执行' Bool '多次执行' Bool BGNL? Newline action+ BEND + + +/* autoEvent_m +tooltip : ????? +helpUrl : https://h5mota.com/games/template/_docs/#/event +default : ["flag:__door__==2",0,null,null,null,null] +var code = { + "condition": EvalString_0, // 条件不可为null + "currentFloor": Bool_0, // 是否仅在本层检测 + "priority": Int_0, // 优先级 + "delayExecute": Bool_1, // 延迟执行 + "multiExecute": Bool_2, // 是否允许多次执行 + "data": 'autoEvent_asdfefw', // 事件列表 +}; +code=JSON.stringify(code,null,2).split('"autoEvent_asdfefw"').join('[\n'+action_0+']\n'); +return code; +*/; + //升级 事件编辑器入口之一 level_m : '等级提升' BGNL? Newline levelCase+ BEND @@ -2755,6 +2776,12 @@ ActionParser.prototype.parse = function (obj,type) { obj.trigger==='action',obj.enable,obj.noPass,obj.displayDamage,this.parseList(obj.data) ]); + case 'autoEvent': + if(!obj)obj={}; + return MotaActionBlocks['autoEvent_m'].xmlText([ + obj.condition,obj.priority,obj.currentFloor,obj.delayExecute,obj.multiExecute,this.parseList(obj.data) + ]); + case 'changeFloor': if(!obj)obj={}; if(!this.isset(obj.loc)) { diff --git a/_server/editor.js b/_server/editor.js index 4fcc47db..ad24d7f1 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -253,16 +253,18 @@ editor.prototype.drawEventBlock = function () { var loc=(i+core.bigmap.offsetX/32)+","+(j+core.bigmap.offsetY/32); if (editor.currentFloorData.events[loc]) color.push('#FF0000'); - if (editor.currentFloorData.changeFloor[loc]) - color.push('#00FF00'); + if (editor.currentFloorData.autoEvent[loc]) + color.push('#FFA500'); if (editor.currentFloorData.afterBattle[loc]) color.push('#FFFF00'); + if (editor.currentFloorData.changeFloor[loc]) + color.push('#00FF00'); if (editor.currentFloorData.afterGetItem[loc]) color.push('#00FFFF'); - if (editor.currentFloorData.afterOpenDoor[loc]) - color.push('#FF00FF'); if (editor.currentFloorData.cannotMove[loc]) color.push('#0000FF'); + if (editor.currentFloorData.afterOpenDoor[loc]) + color.push('#FF00FF'); for(var kk=0,cc;cc=color[kk];kk++){ fg.fillStyle = cc; fg.fillRect(32*i+8*kk, 32*j+32-8, 8, 8); diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 9a1672ce..35f9d135 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -26,6 +26,16 @@ editor_blockly = function () { "本事件触发一次后会消失", {"type": "hide", "time": 500}, ],'event'), + MotaActionFunctions.actionParser.parse({ + "condition": "flag:__door__==2", + "currentFloor": true, + "priority": 0, + "delayExecute": false, + "multiExecute": false, + "data": [ + {"type": "openDoor", "loc": [10,5]} + ], + },'autoEvent'), MotaActionBlocks['changeFloor_m'].xmlText(), MotaActionFunctions.actionParser.parse([{ "id": "moneyShop1", diff --git a/_server/editor_table.js b/_server/editor_table.js index 1278b30d..70ed6246 100644 --- a/_server/editor_table.js +++ b/_server/editor_table.js @@ -145,7 +145,7 @@ editor_table_wrapper = function (editor) { if (key === '_data') continue; if (cobj[key] instanceof Function) cobj[key] = cobj[key](args); } - vobj = args.vobj; + pvobj[ii] = vobj = args.vobj; // 标记为_hide的属性不展示 if (cobj._hide) continue; if (!cobj._leaf) { @@ -343,7 +343,7 @@ editor_table_wrapper = function (editor) { // 1.输入id var newid = '3'; if (mode == 'loc') { - var ae = editor.currentFloorData.autoEvent[editor_mode.pos.x + ',' + editor_mode.pos.x]; + var ae = editor.currentFloorData.autoEvent[editor_mode.pos.x + ',' + editor_mode.pos.y]; if (ae != null) { var testid; for (testid = 3; Object.hasOwnProperty.call(ae, testid); testid++); // 从3开始是因为comment中设置了始终显示012 diff --git a/_server/table/comment.js b/_server/table/comment.js index 6760fe7b..6fe25a60 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -471,13 +471,14 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_action": function (args) { args.vobj=args.vobj||{}; for(var ii=0;ii<3;ii++){ - args.vobj[ii]=null; + args.vobj[ii]=args.vobj[ii]||null; } }, "_data": function (key) { return { "_leaf": true, - "_type": "textarea", + "_type": "event", + "_event": "autoEvent", "_data": "自动事件" } } @@ -513,6 +514,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "afterBattle": {}, "afterGetItem": {}, "afterOpenDoor": {}, + "autoEvent": {}, "cannotMove": {} } } diff --git a/editor-mobile.html b/editor-mobile.html index 62e3ec09..cc411f89 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -195,6 +195,7 @@ --> +