图块碰触事件

This commit is contained in:
ckcz123 2021-07-31 00:23:57 +08:00
parent b8ddb2e167
commit df763b6b95
5 changed files with 32 additions and 2 deletions

View File

@ -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('键值必须是正整数,可以以逗号分隔');
}

View File

@ -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',

View File

@ -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",

View File

@ -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') {

View File

@ -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});
}
////// 绘制中心对称飞行器