Merge branch 'v2.x' of https://github.com/ckcz123/mota-js into v2.x

This commit is contained in:
ckcz123 committed 2021-07-31 00:32:13 +08:00
commit b8b9367da3
11 files changed
+178 -47

No files matched your search

+30 -10
View File
@@ -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
+9 -3
View File
@@ -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;
+6
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',
+1
View File
@@ -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(),
+10
View File
@@ -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;
+5
View File
@@ -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) {
+7
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",