diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index bb3e0f44..9fd002f3 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -331,6 +331,7 @@ action | input_s | input2_s | choices_s + | confirm_s | callBook_s | callSave_s | callLoad_s @@ -1658,6 +1659,20 @@ var code = '{"text": "'+EvalString_0+'"'+IdString_0+EvalString_1+', "action": [\ return code; */; +confirm_s + : '显示确认框' ':' EvalString BGNL? '确定' ':' BGNL? Newline action+ '取消' ':' BGNL? Newline action+ BEND Newline + +/* confirm_s +tooltip : 弹出确认框 +helpUrl : https://h5mota.com/games/template/docs/#/ +default : ["确认要???吗?"] +var code = ['{"type": "confirm", "text": "',EvalString_0,'",\n', + '"yes": [\n',action_0,'],\n', + '"no": [\n',action_1,']\n', +'},\n'].join(''); +return code; +*/; + while_s : '循环处理' ':' '当' expression '时' BGNL? Newline action+ BEND Newline @@ -2570,6 +2585,13 @@ ActionParser.prototype.parseAction = function() { this.insertActionList(data["false"]), this.next]); break; + case "confirm": // 显示确认框 + this.next = MotaActionBlocks['confirm_s'].xmlText([ + this.EvalString(data.text), + this.insertActionList(data["yes"]), + this.insertActionList(data["no"]), + this.next]); + break; case "switch": // 多重条件分歧 var case_caseList = null; for(var ii=data.caseList.length-1,caseNow;caseNow=data.caseList[ii];ii--) { diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 595a55ff..0f05135b 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -76,6 +76,7 @@ editor_blockly = function () { ]) ]) ]), + MotaActionBlocks['confirm_s'].xmlText(), ], '数据相关':[ MotaActionBlocks['setValue_s'].xmlText([ @@ -589,6 +590,7 @@ function omitedcheckUpdateFunction(event) { 'showTextImage_s': 'EvalString_0', 'function_s': 'RawEvalString_0', 'shopsub': 'EvalString_3', + 'confirm_s': 'EvalString_0', } var f = b ? textStringDict[b.type] : null; if (f) {