From df763b6b95c2b73d08ec1afe9ff2f7c007f15f82 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 31 Jul 2021 00:23:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=9D=97=E7=A2=B0=E8=A7=A6=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 3 ++- _server/editor_blockly.js | 6 ++++++ _server/table/comment.js | 7 +++++++ libs/events.js | 16 ++++++++++++++++ libs/ui.js | 2 +- 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 9d137c8e..bc8dceaa 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3009,13 +3009,14 @@ waitContext waitContext_1 - : '按键的场合:' '键值' EvalString '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline + : '按键的场合:' '键值(右键查表)' EvalString '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline /* waitContext_1 tooltip : wait: 等待用户操作并获得按键或点击信息 helpUrl : /_docs/#/instruction colour : this.subColor default : ["",false] +menu : [["查询键值表", "editor_blockly.showKeyCodes()"]] if (!/^\d+(,\d+)*$/.test(EvalString_0)) { throw new Error('键值必须是正整数,可以以逗号分隔'); } diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 7706820b..cc0b53b2 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -414,6 +414,12 @@ editor_blockly = function () { } } + editor_blockly.showKeyCodes = function () { + alert('键值查询表:\nA65 B66 C67 D68 E69 F70 G71 H72 I73 J74 K75 L76 M77\n' + +'N78 O79 P80 Q81 R82 S83 T84 U85 V86 W87 X88 Y89 Z90\n0:48 1:49 2:50 3:51 4:52 5:53 6:54 7:55 8:56 9:57\n' + +'空格:13 回车:32 ESC:27 后退:8 Tab:9 Shift:16 Ctrl:17 Alt:18\nPgUp:33 PgDn:34 左:37 上:38 右:39 下:40\n更多键值请自行百度查表') + } + editor_blockly.lastUsedType=[ 'text_0_s', 'comment_s', diff --git a/_server/table/comment.js b/_server/table/comment.js index 916bdffd..72d68466 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -320,6 +320,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_docs": "碰触脚本", "_data": "触碰到该图块时自动执行的脚本内容;此脚本会在该点的触发器执行前执行" }, + "event": { + "_leaf": true, + "_type": "event", + "_event": "item", + "_docs": "碰触事件", + "_data": "触碰到该图块时自动执行的事件内容;如果存在本事件则不会执行默认触发器" + }, "cannotOut": { "_leaf": true, "_type": "checkboxSet", diff --git a/libs/events.js b/libs/events.js index 528f31dd..38695075 100644 --- a/libs/events.js +++ b/libs/events.js @@ -344,6 +344,14 @@ events.prototype.trigger = function (x, y, callback) { } catch (e) { main.log(e); } } + // 碰触事件 + if (block.event.event) { + core.clearRouteFolding(); + core.insertAction(block.event.event, block.x, block.y); + // 不再执行该点的系统事件 + return _executeCallback(); + } + if (block.event.trigger && block.event.trigger != 'null') { var noPass = block.event.noPass, trigger = block.event.trigger; if (noPass) core.clearAutomaticRouteNode(x, y); @@ -368,6 +376,14 @@ events.prototype._trigger_inAction = function (x, y) { eval(block.event.script); } catch (e) { main.log(e); } + // 碰触事件 + if (block.event.event) { + core.clearRouteFolding(); + core.insertAction(block.event.event, block.x, block.y); + // 不再执行该点的系统事件 + return core.doAction(); + } + if (block.event.trigger && block.event.trigger != 'null') { this.setEvents(null, x, y); if (block.event.trigger == 'action') { diff --git a/libs/ui.js b/libs/ui.js index 6e386e6e..d93c474a 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2439,7 +2439,7 @@ ui.prototype.drawFly = function(page) { } var size = this.PIXEL - 143; core.strokeRect('ui', 20, 100, size, size, '#FFFFFF', 2); - core.drawThumbnail(floorId, null, {ctx: 'ui', x: 20, y: 100, size: size}); + core.drawThumbnail(floorId, null, {ctx: 'ui', x: 20, y: 100, size: size, damage: true}); } ////// 绘制中心对称飞行器