Merge branch 'v2.x' of https://github.com/ckcz123/mota-js into v2.x
This commit is contained in:
commit
b8b9367da3
@ -456,7 +456,7 @@ return code;
|
||||
|
||||
// equip 事件编辑器入口之一
|
||||
equip_m
|
||||
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ '此道具cls须为equips并设置canUseItemEffect' BEND
|
||||
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ '穿上时事件' action+ '脱下时事件' action+ '此道具cls须为equips并设置canUseItemEffect' BEND
|
||||
|
||||
|
||||
/* equip_m
|
||||
@ -468,7 +468,9 @@ if (!/^\d+$/.test(EvalString_0)) {
|
||||
EvalString_0 = '"' + EvalString_0 + '"';
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "animate": "'+IdString_0+'"');
|
||||
var code = '{"type": '+EvalString_0+IdString_0+', "value": {\n'+equipList_0+'\n}, "percentage": {\n'+equipList_1+'\n}}';
|
||||
if (action_0.trim()) action_0 = ', "equipEvent": [\n' + action_0 + ']';
|
||||
if (action_1.trim()) action_1 = ', "unequipEvent": [\n' + action_1 + ']';
|
||||
var code = '{"type": '+EvalString_0+IdString_0+', "value": {\n'+equipList_0+'\n}, "percentage": {\n'+equipList_1+'\n}'+action_0+action_1+'}';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2034,7 +2036,7 @@ return code;
|
||||
*/;
|
||||
|
||||
unloadEquip_s
|
||||
: '卸下装备孔' Int '的装备' Newline
|
||||
: '卸下第' Int '格装备孔的装备' Newline
|
||||
|
||||
|
||||
/* unloadEquip_s
|
||||
@ -2980,19 +2982,20 @@ return code;
|
||||
|
||||
|
||||
wait_s
|
||||
: '等待用户操作并获得按键或点击信息' '超时毫秒数' Int BGNL? Newline waitContext* BEND Newline
|
||||
: '等待用户操作并获得按键或点击信息' '仅检测子块' Bool '超时毫秒数' Int BGNL? Newline waitContext* BEND Newline
|
||||
|
||||
|
||||
/* wait_s
|
||||
tooltip : wait: 等待用户操作并获得按键或点击信息
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : [0]
|
||||
default : [true,0]
|
||||
colour : this.soundColor
|
||||
Bool_0 = Bool_0?(', "forceChild": true'):'';
|
||||
Int_0 = Int_0?(', "timeout": ' + Int_0):'';
|
||||
waitContext_0 = waitContext_0 ? (', "data": [\n' + waitContext_0 + ']') : '';
|
||||
var collapsed=block.isCollapsed()?', "_collapsed": true':'';
|
||||
var disabled=block.isEnabled()?'':', "_disabled": true';
|
||||
var code = '{"type": "wait"' + Int_0 + collapsed + disabled + waitContext_0 + '},\n';
|
||||
var code = '{"type": "wait"' + Bool_0 + Int_0 + collapsed + disabled + waitContext_0 + '},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -3001,17 +3004,19 @@ waitContext
|
||||
: waitContext_1
|
||||
| waitContext_2
|
||||
| waitContext_3
|
||||
| waitContext_4
|
||||
| waitContext_empty;
|
||||
|
||||
|
||||
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('键值必须是正整数,可以以逗号分隔');
|
||||
}
|
||||
@ -3024,7 +3029,7 @@ return code;
|
||||
|
||||
|
||||
waitContext_2
|
||||
: '点击的场合' '像素x范围' PosString '~' PosString '; y范围' PosString '~' PosString '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline
|
||||
: '点击的场合:' '像素x范围' PosString '~' PosString '; y范围' PosString '~' PosString '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline
|
||||
|
||||
/* waitContext_2
|
||||
tooltip : wait: 等待用户操作并获得按键或点击信息
|
||||
@ -3040,11 +3045,26 @@ return code;
|
||||
*/;
|
||||
|
||||
waitContext_3
|
||||
: '超时的场合' '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline
|
||||
: '自定义条件的场合:' expression '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline
|
||||
|
||||
/* waitContext_3
|
||||
tooltip : wait: 等待用户操作并获得按键或点击信息
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["true",false]
|
||||
colour : this.subColor
|
||||
Bool_0 = Bool_0?', "break": true':'';
|
||||
var collapsed=block.isCollapsed()?', "_collapsed": true':'';
|
||||
var disabled=block.isEnabled()?'':', "_disabled": true';
|
||||
var code = '{"case": "condition", "condition": "'+expression_0+'"'+Bool_0+collapsed+disabled+', "action": [\n' + action_0 + ']},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
waitContext_4
|
||||
: '超时的场合:' '不进行剩余判定' Bool BGNL? Newline action+ BEND Newline
|
||||
|
||||
/* waitContext_4
|
||||
tooltip : wait: 等待用户操作并获得按键或点击信息
|
||||
helpUrl : /_docs/#/instruction
|
||||
colour : this.subColor
|
||||
default : [false]
|
||||
Bool_0 = Bool_0?', "break": true':'';
|
||||
@ -3868,7 +3888,7 @@ return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
|
||||
|
||||
equip_e
|
||||
: '装备孔:' Int
|
||||
: '第' Int '格装备孔'
|
||||
|
||||
|
||||
/* equip_e
|
||||
|
||||
@ -82,7 +82,8 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
})
|
||||
return text_choices;
|
||||
}
|
||||
return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage)]);
|
||||
return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage),
|
||||
this.parseList(obj.equipEvent), this.parseList(obj.unequipEvent)]);
|
||||
|
||||
case 'doorInfo':
|
||||
if(!obj) obj={};
|
||||
@ -905,15 +906,19 @@ ActionParser.prototype.parseAction = function() {
|
||||
case_waitList = MotaActionFunctions.xmlText('waitContext_2',[
|
||||
caseNow.px[0], caseNow.px[1], caseNow.py[0], caseNow.py[1], caseNow["break"] || false, this.insertActionList(caseNow.action), case_waitList
|
||||
], /* isShadow */false, /*comment*/ null, /*collapsed*/ caseNow._collapsed, /*disabled*/ caseNow._disabled);
|
||||
} else if (caseNow["case"] == "timeout") {
|
||||
} else if (caseNow["case"] == "condition") {
|
||||
case_waitList = MotaActionFunctions.xmlText('waitContext_3',[
|
||||
this.expandEvalBlock([caseNow.condition]), caseNow["break"] || false, this.insertActionList(caseNow.action), case_waitList
|
||||
], /* isShadow */false, /*comment*/ null, /*collapsed*/ caseNow._collapsed, /*disabled*/ caseNow._disabled);
|
||||
} else if (caseNow["case"] == "timeout") {
|
||||
case_waitList = MotaActionFunctions.xmlText('waitContext_4',[
|
||||
caseNow["break"] || false, this.insertActionList(caseNow.action), case_waitList
|
||||
], /* isShadow */false, /*comment*/ null, /*collapsed*/ caseNow._collapsed, /*disabled*/ caseNow._disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.next = MotaActionFunctions.xmlText('wait_s',[
|
||||
data.timeout||0,case_waitList, this.next], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled);
|
||||
data.forceChild||false,data.timeout||0,case_waitList, this.next], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled);
|
||||
break;
|
||||
case "waitAsync": // 等待所有异步事件执行完毕
|
||||
this.next = MotaActionBlocks['waitAsync_s'].xmlText([
|
||||
@ -1333,6 +1338,7 @@ ActionParser.prototype.expandIdBlock = function(args, isShadow, comment) {
|
||||
ActionParser.prototype.expandEvalBlock = function(args, isShadow, comment) {
|
||||
args[0]=MotaActionFunctions.replaceFromName(args[0])
|
||||
var xml=MotaActionBlocks['evalString_e'].xmlText
|
||||
if (args[0].indexOf('\n') >= 0 || args[0].indexOf('\\n') >= 0) return xml(args, isShadow, comment);
|
||||
var ret=this.matchId(args)
|
||||
if (ret.ret){
|
||||
xml=ret.xml;
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -193,6 +193,7 @@ editor_blocklyconfig=(function(){
|
||||
MotaActionFunctions.actionParser.parseList({"type": "wait", "timeout": 0, "data": [
|
||||
{"case": "keyboard", "keycode": "13,32", "action": [{"type": "comment", "text": "当按下回车(keycode=13)或空格(keycode=32)时执行此事件\n超时剩余时间会写入flag:timeout"}]},
|
||||
{"case": "mouse", "px": [0,32], "py": [0,32], "action": [{"type": "comment", "text": "当点击地图左上角时执行此事件\n超时剩余时间会写入flag:timeout"}]},
|
||||
{"case": "condition", "condition": "flag:type==0\n&&flag:keycode==13", "action": [{"type": "comment", "text": "当满足自定义条件时会执行此事件\n超时剩余时间会写入flag:timeout"}]},
|
||||
{"case": "timeout", "action": [{"type": "comment", "text": "当超时未操作时执行此事件"}]},
|
||||
]}),
|
||||
MotaActionBlocks['waitAsync_s'].xmlText(),
|
||||
|
||||
@ -407,6 +407,11 @@ editor_mappanel_wrapper = function (editor) {
|
||||
var index = editor.core.floorIds.indexOf(editor.currentFloorId);
|
||||
var toId = editor.currentFloorId;
|
||||
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
if (saveFloor && saveFloor.classList.contains('highlight')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (direct > 0 && index < editor.core.floorIds.length - 1)
|
||||
toId = editor.core.floorIds[index + 1];
|
||||
else if (direct < 0 && index > 0)
|
||||
@ -433,6 +438,11 @@ editor_mappanel_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
editor.uifunctions.undoFloor_click = function () {
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
if (saveFloor && saveFloor.classList.contains('highlight')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var toId = editor.uivalues.recentFloors.pop();
|
||||
if (toId == null || toId == editor.currentFloorId) return;
|
||||
|
||||
|
||||
@ -164,6 +164,11 @@ editor_ui_wrapper = function (editor) {
|
||||
// PGUP和PGDOWN切换楼层
|
||||
if (e.keyCode == 33 || e.keyCode == 34) {
|
||||
e.preventDefault();
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
if (saveFloor && saveFloor.classList.contains('highlight')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = editor.core.floorIds.indexOf(editor.currentFloorId);
|
||||
var nextIndex = index + (e.keyCode == 33 ? 1 : -1);
|
||||
if (nextIndex >= 0 && nextIndex < editor.core.floorIds.length) {
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -777,16 +777,18 @@ actions.prototype._sys_onmousewheel = function (direct) {
|
||||
|
||||
// wait事件
|
||||
if (core.status.lockControl && core.status.event.id == 'action' && core.status.event.data.type == 'wait') {
|
||||
clearTimeout(core.status.event.interval);
|
||||
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
|
||||
delete core.status.event.timeout;
|
||||
core.setFlag('type', 0);
|
||||
var keycode = direct == 1 ? 33 : 34;
|
||||
core.setFlag('keycode', keycode);
|
||||
core.setFlag('timeout', timeout);
|
||||
core.status.route.push("input:" + (1e8 * timeout + keycode));
|
||||
core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
core.doAction();
|
||||
var executed = core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
if (executed || !core.status.event.data.current.forceChild) {
|
||||
core.status.route.push("input:" + (1e8 * timeout + keycode));
|
||||
clearTimeout(core.status.event.interval);
|
||||
delete core.status.event.timeout;
|
||||
core.doAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1040,18 +1042,20 @@ actions.prototype._clickAction = function (x, y, px, py) {
|
||||
}
|
||||
|
||||
if (core.status.event.data.type == 'wait') {
|
||||
clearTimeout(core.status.event.interval);
|
||||
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
|
||||
delete core.status.event.timeout;
|
||||
core.setFlag('type', 1);
|
||||
core.setFlag('x', x);
|
||||
core.setFlag('y', y);
|
||||
core.setFlag('px', px);
|
||||
core.setFlag('py', py);
|
||||
core.setFlag('timeout', timeout);
|
||||
core.status.route.push("input:" + (1e8 * timeout + 1000000 + 1000 * px + py));
|
||||
core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
core.doAction();
|
||||
var executed = core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
if (executed || !core.status.event.data.current.forceChild) {
|
||||
core.status.route.push("input:" + (1e8 * timeout + 1000000 + 1000 * px + py));
|
||||
clearTimeout(core.status.event.interval);
|
||||
delete core.status.event.timeout;
|
||||
core.doAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1134,15 +1138,17 @@ actions.prototype._keyUpAction = function (keycode) {
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data.type == 'wait') {
|
||||
clearTimeout(core.status.event.interval);
|
||||
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
|
||||
delete core.status.event.timeout;
|
||||
core.setFlag('type', 0);
|
||||
core.setFlag('keycode', keycode);
|
||||
core.setFlag('timeout', timeout);
|
||||
core.status.route.push("input:" + (1e8 * timeout + keycode));
|
||||
core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
core.doAction();
|
||||
var executed = core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
if (executed || !core.status.event.data.current.forceChild) {
|
||||
core.status.route.push("input:" + (1e8 * timeout + keycode));
|
||||
clearTimeout(core.status.event.interval);
|
||||
delete core.status.event.timeout;
|
||||
core.doAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data.type == 'choices') {
|
||||
@ -1503,6 +1509,7 @@ actions.prototype._clickToolbox = function (x, y) {
|
||||
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1678,6 +1685,7 @@ actions.prototype._keyUpToolbox = function (keycode) {
|
||||
if (keycode == 84 || keycode == 27 || keycode == 88) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data == null) return;
|
||||
@ -1704,6 +1712,7 @@ actions.prototype._clickEquipbox = function (x, y) {
|
||||
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1861,6 +1870,7 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) {
|
||||
if (keycode == 81 || keycode == 27 || keycode == 88) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
if (!core.status.event.data.selectId) return;
|
||||
|
||||
38
libs/core.js
38
libs/core.js
@ -292,6 +292,13 @@ core.prototype._init_flags = function () {
|
||||
document.title = core.firstData.title + " - HTML5魔塔";
|
||||
document.getElementById("startLogo").innerText = core.firstData.title;
|
||||
(core.firstData.shops||[]).forEach(function (t) { core.initStatus.shops[t.id] = t; });
|
||||
|
||||
core.maps._initFloors();
|
||||
// 初始化怪物、道具等
|
||||
core.material.enemys = core.enemys.getEnemys();
|
||||
core.material.items = core.items.getItems();
|
||||
core.material.icons = core.icons.getIcons();
|
||||
|
||||
// 初始化自动事件
|
||||
for (var floorId in core.floors) {
|
||||
var autoEvents = core.floors[floorId].autoEvent || {};
|
||||
@ -312,7 +319,33 @@ core.prototype._init_flags = function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 道具的穿上/脱下,视为自动事件
|
||||
for (var equipId in core.material.items) {
|
||||
var equip = core.material.items[equipId];
|
||||
if (equip.cls != 'equips' || !equip.equip) continue;
|
||||
if (!equip.equip.equipEvent && !equip.equip.unequipEvent) continue;
|
||||
var equipFlag = '_equipEvent_' + equipId;
|
||||
var autoEvent1 = {
|
||||
symbol: "_equipEvent_" + equipId,
|
||||
currentFloor: false,
|
||||
multiExecute: true,
|
||||
condition: "core.hasEquip('" + equipId + "') && !core.hasFlag('"+equipFlag+"')",
|
||||
data: core.precompile([{"type": "setValue", "name": "flag:" + equipFlag, "value": "true"}].concat(equip.equip.equipEvent||[])),
|
||||
};
|
||||
var autoEvent2 = {
|
||||
symbol: "_unequipEvent_" + equipId,
|
||||
currentFloor: false,
|
||||
multiExecute: true,
|
||||
condition: "!core.hasEquip('" + equipId + "') && core.hasFlag('"+equipFlag+"')",
|
||||
data: core.precompile([{"type": "setValue", "name": "flag:" + equipFlag, "value": "null"}].concat(equip.equip.unequipEvent||[])),
|
||||
};
|
||||
core.initStatus.autoEvents.push(autoEvent1);
|
||||
core.initStatus.autoEvents.push(autoEvent2);
|
||||
}
|
||||
|
||||
core.initStatus.autoEvents.sort(function (e1, e2) {
|
||||
if (e1.floorId == null) return 1;
|
||||
if (e2.floorId == null) return -1;
|
||||
if (e1.priority != e2.priority) return e2.priority - e1.priority;
|
||||
if (e1.floorId != e2.floorId) return core.floorIds.indexOf(e1.floorId) - core.floorIds.indexOf(e2.floorId);
|
||||
if (e1.x != e2.x) return e1.x - e2.x;
|
||||
@ -320,11 +353,6 @@ core.prototype._init_flags = function () {
|
||||
return e1.index - e2.index;
|
||||
})
|
||||
|
||||
core.maps._initFloors();
|
||||
// 初始化怪物、道具等
|
||||
core.material.enemys = core.enemys.getEnemys();
|
||||
core.material.items = core.items.getItems();
|
||||
core.material.icons = core.icons.getIcons();
|
||||
}
|
||||
|
||||
core.prototype._init_sys_flags = function () {
|
||||
|
||||
@ -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') {
|
||||
@ -1104,15 +1120,25 @@ events.prototype.checkAutoEvents = function () {
|
||||
|
||||
core.autoEventExecuting(symbol, true);
|
||||
core.autoEventExecuted(symbol, true);
|
||||
|
||||
var event = [
|
||||
{"type": "function", "function":
|
||||
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"},
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
|
||||
var event;
|
||||
if (x == null && y == null) {
|
||||
event = [
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
} else {
|
||||
event = [
|
||||
{"type": "function", "function":
|
||||
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"},
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
}
|
||||
|
||||
if (autoEvent.delayExecute)
|
||||
delay.push(event);
|
||||
@ -2361,7 +2387,7 @@ events.prototype.__action_wait_getValue = function (value) {
|
||||
}
|
||||
|
||||
events.prototype.__action_wait_afterGet = function (data) {
|
||||
if (!data.data) return;
|
||||
if (!data.data) return false;
|
||||
var todo = [];
|
||||
var stop = false;
|
||||
data.data.forEach(function (one) {
|
||||
@ -2386,20 +2412,32 @@ events.prototype.__action_wait_afterGet = function (data) {
|
||||
if (one["break"]) stop = true;
|
||||
}
|
||||
}
|
||||
if (one["case"] == "condition") {
|
||||
var condition = false;
|
||||
try { condition = core.calValue(one.condition); } catch (e) {}
|
||||
if (condition) {
|
||||
core.push(todo, one.action);
|
||||
if (one["break"]) stop = true;
|
||||
}
|
||||
}
|
||||
if (one["case"] == "timeout" && core.getFlag("type") == -1) {
|
||||
core.push(todo, one.action);
|
||||
if (one["break"]) stop = true;
|
||||
}
|
||||
})
|
||||
if (todo.length > 0)
|
||||
if (todo.length > 0) {
|
||||
core.insertAction(todo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
events.prototype._precompile_wait = function (data) {
|
||||
if (data.data) {
|
||||
data.data.forEach(function (v) {
|
||||
if (v.px) v.px = this.__precompile_array(v.px);
|
||||
if (v.py) v.py = this.__precompile_array(v.py);
|
||||
if (v.px != null) v.px = this.__precompile_array(v.px);
|
||||
if (v.py != null) v.py = this.__precompile_array(v.py);
|
||||
if (v.condition != null) v.condition = this.__precompile_array(v.condition);
|
||||
v.action = this.precompile(v.action);
|
||||
}, this);
|
||||
}
|
||||
|
||||
@ -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});
|
||||
}
|
||||
|
||||
////// 绘制中心对称飞行器
|
||||
|
||||
Loading…
Reference in New Issue
Block a user