update converter.bundle&调整双击blockly的判定

This commit is contained in:
YouWei Zhao 2020-05-22 19:49:05 +08:00
parent cd27054679
commit daa014b7b3
3 changed files with 73 additions and 53 deletions

View File

@ -1,6 +1,16 @@
// 编辑此文件用的vscode插件: https://marketplace.visualstudio.com/items?itemName=zhaouv.vscode-mota-js-extension
// 此文件通过antlr-blockly生成编辑器中的图块, 相关帮助说明: https://zhaouv.github.io/antlr-blockly/docs/#/README
/*
特殊注入demo
doubleclicktext : EvalString_1
previewBlock : true
// [x, y, floorId, forceFloor]
selectPoint : ["PosString_0", "PosString_1", "IdString_0", true]
*/
grammar MotaAction;
//===============parser===============
@ -110,6 +120,7 @@ shopsub
/* shopsub
tooltip : 全局商店
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
doubleclicktext : EvalString_1
default : ["shop1","贪婪之神","moneyShop","勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:","金币商店",false,false]
var title='';
if (EvalString_0==''){
@ -279,6 +290,7 @@ changeFloor_m
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
helpUrl : https://h5mota.com/games/template/_docs/#/element?id=%e8%b7%af%e9%9a%9c%ef%bc%8c%e6%a5%bc%e6%a2%af%ef%bc%8c%e4%bc%a0%e9%80%81%e9%97%a8
default : [null,"MTx",null,"","",null,"",null]
selectPoint : ["PosString_0", "PosString_1", "IdString_0", true]
var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
var loc = '';
@ -661,6 +673,7 @@ text_0_s
/* text_0_s
tooltip : text显示一段文字剧情
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=text%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%96%87%E5%AD%97%EF%BC%88%E5%89%A7%E6%83%85%EF%BC%89
doubleclicktext : EvalString_0
default : ["欢迎使用事件编辑器(双击方块进入多行编辑)"]
var code = '"'+EvalString_0+'",\n';
return code;
@ -673,6 +686,7 @@ text_1_s
/* text_1_s
tooltip : text显示一段文字剧情,选项较多请右键点击帮助
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=text%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%96%87%E5%AD%97%EF%BC%88%E5%89%A7%E6%83%85%EF%BC%89
doubleclicktext : EvalString_3
default : ["小妖精","fairy","","欢迎使用事件编辑器(双击方块进入多行编辑)"]
var title='';
if (EvalString_0==''){
@ -697,6 +711,7 @@ comment_s
/* comment_s
tooltip : comment添加一段会被游戏跳过的注释内容
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=comment%ef%bc%9a%e6%b7%bb%e5%8a%a0%e6%b3%a8%e9%87%8a
doubleclicktext : EvalString_0
default : ["可以在这里写添加任何注释内容"]
colour : this.commentColor
var code = '{"type": "comment", "text": "'+EvalString_0+'"},\n';
@ -710,6 +725,7 @@ autoText_s
/* autoText_s
tooltip : autoText自动剧情文本,用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=autotext%EF%BC%9A%E8%87%AA%E5%8A%A8%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC
doubleclicktext : EvalString_2
default : ["小妖精","fairy","",3000,"用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示"]
var title='';
if (EvalString_0==''){
@ -734,6 +750,7 @@ scrollText_s
/* scrollText_s
tooltip : scrollText滚动剧情文本将从下到上进行滚动显示。
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=scrollText%ef%bc%9a%e6%bb%9a%e5%8a%a8%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac
doubleclicktext : EvalString_0
default : [5000,1.4,false,"时间是总时间可以使用setText事件来控制字体、颜色、大小、偏移量等"]
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "scrollText", "text": "'+EvalString_0+'"'+Bool_0+', "time" :'+Int_0+', "lineHeight": '+Number_0+'},\n';
@ -884,6 +901,7 @@ show_s
tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=show%EF%BC%9A%E5%B0%86%E4%B8%80%E4%B8%AA%E7%A6%81%E7%94%A8%E4%BA%8B%E4%BB%B6%E5%90%AF%E7%94%A8
default : ["","","","",false]
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
@ -917,6 +935,7 @@ hide_s
tooltip : hide: 隐藏事件,同时可删除
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=hide%EF%BC%9A%E5%B0%86%E4%B8%80%E4%B8%AA%E5%90%AF%E7%94%A8%E4%BA%8B%E4%BB%B6%E7%A6%81%E7%94%A8
default : ["","","",true,"",false]
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
@ -951,6 +970,7 @@ trigger_s
tooltip : trigger: 立即触发另一个地点的事件
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
default : ["",""]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.eventColor
var floorstr = '';
if (PosString_0 && PosString_1) {
@ -987,6 +1007,7 @@ tooltip : insert: 立即插入另一个地点的事件执行,当前事件不
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=insert%ef%bc%9a%e6%8f%92%e5%85%a5%e5%85%ac%e5%85%b1%e4%ba%8b%e4%bb%b6%e6%88%96%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%9c%b0%e7%82%b9%e7%9a%84%e4%ba%8b%e4%bb%b6%e5%b9%b6%e6%89%a7%e8%a1%8c
default : ["0","0",null,"",""]
colour : this.eventColor
selectPoint : ["PosString_0", "PosString_1", "IdString_0"]
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
if (JsonEvalString_0) {
if (!(JSON.parse(JsonEvalString_0) instanceof Array))
@ -1025,6 +1046,7 @@ tooltip : setBlock设置某个图块,忽略坐标楼层则为当前事件
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
colour : this.mapColor
default : ["yellowDoor","","","","",false]
selectPoint : ["EvalString_1", "EvalString_2", "IdString_0"]
var floorstr = '';
if (EvalString_1 && EvalString_2) {
var pattern1 = MotaActionFunctions.pattern.id;
@ -1058,6 +1080,7 @@ tooltip : turnBlock事件转向自动检索faceIds
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
colour : this.mapColor
default : [null,"","",""]
selectPoint : ["EvalString_1", "EvalString_2", "IdString_0"]
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = MotaActionFunctions.pattern.id;
@ -1090,6 +1113,7 @@ showFloorImg_s
tooltip : showFloorImg: 显示一个贴图xy为左上角坐标可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=showFloorImg%ef%bc%9a%e6%98%be%e7%a4%ba%e8%b4%b4%e5%9b%be
default : ["","",""]
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
@ -1122,6 +1146,7 @@ tooltip : hideFloorImg: 隐藏一个贴图xy为左上角坐标可用逗号
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=hideFloorImg%ef%bc%9a%e9%9a%90%e8%97%8f%e8%b4%b4%e5%9b%be
default : ["","",""]
colour : this.mapColor
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = MotaActionFunctions.pattern.id;
@ -1152,6 +1177,7 @@ showBgFgMap_s
tooltip : showBgFgMap: 显示图层块,即背景图层/前景图层的某些图块xy为左上角坐标可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=showFloorImg%ef%bc%9a%e6%98%be%e7%a4%ba%e8%b4%b4%e5%9b%be
default : ["bg","","",""]
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
@ -1184,6 +1210,7 @@ tooltip : hideBgFgMap: 隐藏图层块,即背景图层/前景图层的某些
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=hideFloorImg%ef%bc%9a%e9%9a%90%e8%97%8f%e8%b4%b4%e5%9b%be
default : ["bg","","",""]
colour : this.mapColor
selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"]
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = MotaActionFunctions.pattern.id;
@ -1214,6 +1241,7 @@ setBgFgBlock_s
tooltip : setBgFgBlock设置某个图层块,忽略坐标楼层则为当前点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
colour : this.mapColor
selectPoint : ["EvalString_1", "EvalString_2", "IdString_0"]
default : ["bg","yellowDoor","","",""]
var floorstr = '';
if (EvalString_1 && EvalString_2) {
@ -1375,6 +1403,7 @@ openDoor_s
tooltip : openDoor: 开门,楼层可不填表示当前层
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
default : ["","","",false,false]
selectPoint : ["PosString_0", "PosString_1", "IdString_0"]
colour : this.mapColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var floorstr = '';
@ -1395,6 +1424,7 @@ closeDoor_s
tooltip : closeDoor: 关门事件,需要该点本身无事件
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
default : ["","","yellowDoor",false]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.mapColor
var floorstr = '';
if (PosString_0 && PosString_1) {
@ -1413,6 +1443,7 @@ changeFloor_s
tooltip : changeFloor: 楼层切换,动画时间可不填
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changefloor%EF%BC%9A%E6%A5%BC%E5%B1%82%E5%88%87%E6%8D%A2
default : [null,"",null,"","",null,"",null]
selectPoint : ["PosString_0", "PosString_1", "IdString_0", true]
colour : this.dataColor
var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
@ -1438,6 +1469,7 @@ changePos_s
tooltip : changePos: 当前位置切换
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changepos%EF%BC%9A%E5%BD%93%E5%89%8D%E4%BD%8D%E7%BD%AE%E5%88%87%E6%8D%A2%E5%8B%87%E5%A3%AB%E8%BD%AC%E5%90%91
default : ["","",null]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.dataColor
var loc = (PosString_0 && PosString_1) ? (', "loc": ['+PosString_0+','+PosString_1+']') : '';
if (DirectionEx_List_0 == 'null') DirectionEx_List_0 = '';
@ -1562,6 +1594,7 @@ animate_s
tooltip : animate显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=animate%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%8A%A8%E7%94%BB
default : ["zone","hero",false,false]
selectPoint : ["EvalString_0", "EvalString_0"]
colour : this.soundColor
if (EvalString_0) {
if(MotaActionFunctions.pattern.id2.test(EvalString_0)) {
@ -1588,6 +1621,7 @@ setViewport_s
tooltip : setViewport: 设置视角
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changepos%EF%BC%9A%E5%BD%93%E5%89%8D%E4%BD%8D%E7%BD%AE%E5%88%87%E6%8D%A2%E5%8B%87%E5%A3%AB%E8%BD%AC%E5%90%91
default : ["",""]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.soundColor
var loc = '';
if (PosString_0 && PosString_1) {
@ -1662,6 +1696,7 @@ showTextImage_s
/* showTextImage_s
tooltip : showTextImage显示图片化文本
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=showTextImage%ef%bc%9a%e6%98%be%e7%a4%ba%e6%96%87%e6%9c%ac%e5%8c%96%e5%9b%be%e7%89%87
doubleclicktext : EvalString_0
colour : this.printColor
default : ["可以使用setText事件来控制字体、颜色、大小、偏移量等",1,"0","0",1.4,1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
@ -1790,6 +1825,7 @@ move_s
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
default : ["","",500,false,false,"上右3下2后4左前2"]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.mapColor
var floorstr = '';
if (PosString_0 && PosString_1) {
@ -1838,7 +1874,10 @@ jump_s
tooltip : jump: 让某个NPC/怪物跳跃
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=jump%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AANPC%2F%E6%80%AA%E7%89%A9%E8%B7%B3%E8%B7%83
default : ["","","","",500,true,false]
selectPoint : ["PosString_2", "PosString_3"]
colour : this.mapColor
// selectPoint 跳跃暂时只考虑终点
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr += ', "from": ['+PosString_0+','+PosString_1+']';
@ -1861,6 +1900,7 @@ jumpHero_s
tooltip : jumpHero: 跳跃勇士
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=jumpHero%EF%BC%9A%E8%B7%B3%E8%B7%83%E5%8B%87%E5%A3%AB
default : ["","",500,false]
selectPoint : ["PosString_0", "PosString_1"]
colour : this.dataColor
var floorstr = '';
if (PosString_0 && PosString_1) {
@ -2107,6 +2147,7 @@ choices_s
/* choices_s
tooltip : choices: 给用户提供选项
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=choices%EF%BC%9A%E7%BB%99%E7%94%A8%E6%88%B7%E6%8F%90%E4%BE%9B%E9%80%89%E9%A1%B9
doubleclicktext : EvalString_0
default : ["","流浪者","trader",0]
var title='';
if (EvalString_1==''){
@ -2148,6 +2189,7 @@ confirm_s
tooltip : 弹出确认框
helpUrl : https://h5mota.com/games/template/_docs/#/
default : ["确认要xxx吗?",0,false]
doubleclicktext : EvalString_0
Bool_0 = Bool_0?', "default": true':''
Int_0 = Int_0 ? (', "timeout": '+Int_0) : '';
var code = ['{"type": "confirm"'+Int_0+Bool_0+', "text": "',EvalString_0,'",\n',
@ -2279,6 +2321,7 @@ waitContext_2
tooltip : wait: 等待用户操作并获得按键或点击信息
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=wait%EF%BC%9A%E7%AD%89%E5%BE%85%E7%94%A8%E6%88%B7%E6%93%8D%E4%BD%9C
default : [0,32,0,32]
previewBlock : true
colour : this.subColor
var code = '{"case": "mouse", "px": [' + PosString_0 + ',' + PosString_1 + '], "py": [' + PosString_2 + ',' + PosString_3 + '], "action": [\n' + action_0 + ']},\n';
return code;
@ -2365,6 +2408,7 @@ previewUI_s
/* previewUI_s
tooltip : previewUI: ui绘制并预览
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=previewUI%ef%bc%9aUI%e7%bb%98%e5%88%b6%e5%b9%b6%e9%a2%84%e8%a7%88
previewBlock : true
var code = ['{"type": "previewUI", "action": [\n', action_0,']},\n'].join('');
return code;
*/;
@ -2378,6 +2422,7 @@ tooltip : clearMap: 清除画布
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=clearMap%ef%bc%9a%e6%b8%85%e9%99%a4%e7%94%bb%e5%b8%83
colour : this.subColor
default : ["0", "0", "100", "100"]
previewBlock : true
var code = '{"type": "clearMap", "x": ' + PosString_0 + ', "y": ' + PosString_1 +
', "width": ' + PosString_2 + ', "height": ' + PosString_3 + '},\n';
return code;
@ -2390,6 +2435,7 @@ clearMap_1_s
/* clearMap_1_s
tooltip : clearMap: 清除画布
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=clearMap%ef%bc%9a%e6%b8%85%e9%99%a4%e7%94%bb%e5%b8%83
previewBlock : true
colour : this.subColor
var code = '{"type": "clearMap"},\n';
return code;
@ -2402,6 +2448,7 @@ setAttribute_s
/* setAttribute_s
tooltip : setAttribute设置画布属性
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setAttribute%ef%bc%9a%e8%ae%be%e7%bd%ae%e7%94%bb%e5%b8%83%e5%b1%9e%e6%80%a7
previewBlock : true
colour : this.subColor
default : ["","",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"","",null,null,""]
TextAlign_List_0 = TextAlign_List_0==='null'?'': ', "align": "'+TextAlign_List_0+'"';
@ -2428,6 +2475,7 @@ fillText_s
tooltip : fillText绘制一行文本可以设置最大宽度进行放缩
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=fillText%ef%bc%9a%e7%bb%98%e5%88%b6%e6%96%87%e6%9c%ac
colour : this.subColor
previewBlock : true
default : ["0","0","",'rgba(255,255,255,1)',"","","绘制一行文本"]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
FontString_0 = FontString_0 ? (', "font": "' + FontString_0 + '"') : '';
@ -2443,6 +2491,7 @@ fillBoldText_s
tooltip : fillBoldText绘制一行描边文本
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=fillBoldText%ef%bc%9a%e7%bb%98%e5%88%b6%e6%8f%8f%e8%be%b9%e6%96%87%e6%9c%ac
colour : this.subColor
previewBlock : true
default : ["0","0","",'rgba(255,255,255,1)',"",'rgba(0,0,0,1)',"","绘制一行描边文本"]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
ColorString_1 = ColorString_1 ? (', "strokeStyle": ['+ColorString_1+']') : '';
@ -2457,6 +2506,7 @@ drawTextContent_s
/* drawTextContent_s
tooltip : drawTextContent绘制多行文本
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawTextContent%ef%bc%9a%e7%bb%98%e5%88%b6%e5%a4%9a%e8%a1%8c%e6%96%87%e6%9c%ac
doubleclicktext : EvalString_0
colour : this.subColor
default : ["绘制多行文本\\n可双击编辑","0","0","","",'rgba(255,255,255,1)',null,"","",false]
TextAlign_List_0 = TextAlign_List_0==='null'?'': ', "align": "'+TextAlign_List_0+'"';
@ -2476,6 +2526,7 @@ fillRect_s
tooltip : fillRect绘制矩形
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=fillRect%ef%bc%9a%e7%bb%98%e5%88%b6%e7%9f%a9%e5%bd%a2
colour : this.subColor
previewBlock : true
default : ["0","0","flag:x","300","","",null]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
PosString_4 = PosString_4 ? (', "radius": '+PosString_4) : '';
@ -2490,6 +2541,7 @@ strokeRect_s
tooltip : strokeRect绘制矩形边框
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=strokeRect%ef%bc%9a%e7%bb%98%e5%88%b6%e7%9f%a9%e5%bd%a2%e8%be%b9%e6%a1%86
colour : this.subColor
previewBlock : true
default : ["0","0","flag:x","300","","",null,""]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
IntString_0 = IntString_0 ? (', "lineWidth": '+IntString_0) : '';
@ -2505,6 +2557,7 @@ drawLine_s
tooltip : drawLine绘制线段
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawLine%ef%bc%9a%e7%bb%98%e5%88%b6%e7%ba%bf%e6%ae%b5
colour : this.subColor
previewBlock : true
default : ["0","0","flag:x","300","",null,""]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
IntString_0 = IntString_0 ? (', "lineWidth": '+IntString_0) : '';
@ -2519,6 +2572,7 @@ drawArrow_s
tooltip : drawArrow绘制箭头
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawArrow%ef%bc%9a%e7%bb%98%e5%88%b6%e7%ae%ad%e5%a4%b4
colour : this.subColor
previewBlock : true
default : ["0","0","flag:x","300","",null,""]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
IntString_0 = IntString_0 ? (', "lineWidth": '+IntString_0) : '';
@ -2534,6 +2588,7 @@ fillPolygon_s
tooltip : fillPolygon绘制多边形
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=fillPolygon%ef%bc%9a%e7%bb%98%e5%88%b6%e5%a4%9a%e8%be%b9%e5%bd%a2
colour : this.subColor
previewBlock : true
default : ["0,0,100","0,100,0","",null]
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
@ -2554,6 +2609,7 @@ strokePolygon_s
tooltip : strokePolygon绘制多边形边框
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=strokePolygon%ef%bc%9a%e7%bb%98%e5%88%b6%e5%a4%9a%e8%be%b9%e5%bd%a2%e8%be%b9%e6%a1%86
colour : this.subColor
previewBlock : true
default : ["0,0,100","0,100,0","",null,""]
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
@ -2574,6 +2630,7 @@ fillEllipse_s
tooltip : fillEllipse绘制椭圆
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=fillEllipse%ef%bc%9a%e7%bb%98%e5%88%b6%e5%9c%86
colour : this.subColor
previewBlock : true
default : ["0","0","100","100","0","",null]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
PosString_4 = PosString_4 ? (', "angle": ' + PosString_4) : '';
@ -2588,6 +2645,7 @@ strokeEllipse_s
tooltip : strokeEllipse绘制椭圆边框
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=strokeEllipse%ef%bc%9a%e7%bb%98%e5%88%b6%e5%9c%86%e8%be%b9%e6%a1%86
colour : this.subColor
previewBlock : true
default : ["0","0","100","100","0","",null,""]
ColorString_0 = ColorString_0 ? (', "style": ['+ColorString_0+']') : '';
IntString_0 = IntString_0 ? (', "lineWidth": '+IntString_0) : '';
@ -2633,6 +2691,7 @@ drawImage_s
/* drawImage_s
tooltip : drawImage绘制图片
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawImage%ef%bc%9a%e7%bb%98%e5%88%b6%e5%9b%be%e7%89%87
previewBlock : true
default : ["bg.jpg","null","0","0","",""]
colour : this.subColor
if (Reverse_List_0 && Reverse_List_0 != 'null') {
@ -2654,6 +2713,7 @@ tooltip : drawImage绘制图片
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawImage%ef%bc%9a%e7%bb%98%e5%88%b6%e5%9b%be%e7%89%87
default : ["bg.jpg","0","0","32","32","0","0","32","32"]
colour : this.subColor
previewBlock : true
if (Reverse_List_0 && Reverse_List_0 != 'null') {
Reverse_List_0 = ', "reverse": "' + Reverse_List_0 + '"';
} else Reverse_List_0 = '';
@ -2671,6 +2731,7 @@ drawIcon_s
tooltip : drawIcon绘制图标
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawIcon%ef%bc%9a%e7%bb%98%e5%88%b6%e5%9b%be%e6%a0%87
default : ["yellowKey",0,"0","0","",""]
previewBlock : true
colour : this.subColor
Int_0 = Int_0 ? (', "frame": '+Int_0) : '';
PosString_2 = PosString_2 ? (', "width": '+PosString_2) : '';
@ -2688,6 +2749,7 @@ tooltip : drawBackground绘制背景
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawBackground%ef%bc%9a%e7%bb%98%e5%88%b6%e8%83%8c%e6%99%af%e5%9b%be
default : ["winskin.png",null,"0","0","100","100"]
colour : this.subColor
previewBlock : true
var colorRe = MotaActionFunctions.pattern.colorRe;
if (colorRe.test(EvalString_0)) {
EvalString_0 = ', "background": ['+EvalString_0+']';
@ -2709,6 +2771,7 @@ drawSelector_s
/* drawSelector_s
tooltip : drawSelector绘制闪烁光标
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=drawSelector%ef%bc%9a%e7%bb%98%e5%88%b6%e9%97%aa%e7%83%81%e5%85%89%e6%a0%87
previewBlock : true
default : ["winskin.png","1","0","0","100","100"]
colour : this.subColor
var code = '{"type": "drawSelector", "image": "'+EvalString_0+'", "code": '+Int_0+', "x": '+PosString_0+', "y": '+PosString_1+', "width": '+PosString_2+', "height": '+PosString_3+'},\n';
@ -2723,6 +2786,7 @@ drawSelector_1_s
tooltip : drawSelector清除闪烁光标
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : ["1"]
previewBlock : true
colour : this.subColor
var code = '{"type": "drawSelector", "code": '+Int_0+'},\n';
return code;
@ -2753,6 +2817,7 @@ tooltip : 可双击多行编辑请勿使用异步代码。常见API参见文
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=function%EF%BC%9A%E8%87%AA%E5%AE%9A%E4%B9%89js%E8%84%9A%E6%9C%AC
default : [false,"alert(core.getStatus(\"atk\"));"]
colour : this.dataColor
doubleclicktext : RawEvalString_0
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "function"'+Bool_0+', "function": "function(){\\n'+JSON.stringify(RawEvalString_0).slice(1,-1).split('\\\\n').join('\\n')+'\\n}"},\n';
return code;

File diff suppressed because one or more lines are too long

View File

@ -231,14 +231,8 @@ editor_blockly = function () {
}
var previewBlock = function (b) {
var types = [
"previewUI_s", "clearMap_s", "clearMap_1_s", "setAttribute_s", "fillText_s",
"fillBoldText_s", "fillRect_s", "strokeRect_s", "drawLine_s",
"drawArrow_s", "fillPolygon_s", "strokePolygon_s", "fillEllipse_s", "strokeEllipse_s", "fillArc_s", "strokeArc_s",
"drawImage_s", "drawImage_1_s", "drawIcon_s", "drawBackground_s", "drawSelector_s", "drawSelector_1_s",
"waitContext_2"
];
if (b && types.indexOf(b.type)>=0) {
if (b && MotaActionBlocks[b.type].previewBlock) {
try {
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e|z)/g, '\\\\$1') + "]";
eval("var obj="+code);
@ -264,30 +258,17 @@ editor_blockly = function () {
if (previewBlock(b)) return;
if (b && b.type in selectPointBlocks) { // selectPoint
if (b && MotaActionBlocks[b.type].selectPoint) { // selectPoint
this.selectPoint();
return;
}
var textStringDict = {
'text_0_s': 'EvalString_0',
'text_1_s': 'EvalString_2',
'autoText_s': 'EvalString_2',
'scrollText_s': 'EvalString_0',
'comment_s': 'EvalString_0',
'choices_s': 'EvalString_0',
'showTextImage_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_1',
'confirm_s': 'EvalString_0',
'drawTextContent_s': 'EvalString_0',
}
var f = b ? textStringDict[b.type] : null;
var f = b ? MotaActionBlocks[b.type].doubleclicktext : null;
if (f) {
var value = b.getFieldValue(f);
//多行编辑
editor_multi.multiLineEdit(value, b, f, {'lint': f === 'RawEvalString_0'}, function (newvalue, b, f) {
if (textStringDict[b.type] !== 'RawEvalString_0') {
if (MotaActionBlocks[b.type].doubleclicktext !== 'RawEvalString_0') {
}
b.setFieldValue(newvalue.split('\n').join('\\n'), f);
});
@ -374,37 +355,11 @@ editor_blockly = function () {
// ------ select point ------
// id: [x, y, floorId, forceFloor]
var selectPointBlocks = {
"changeFloor_m": ["PosString_0", "PosString_1", "IdString_0", true],
"jumpHero_s": ["PosString_0", "PosString_1"],
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0", true],
"changePos_s": ["PosString_0", "PosString_1"],
"battle_1_s": ["PosString_0", "PosString_1"],
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
"closeDoor_s": ["PosString_0", "PosString_1"],
"show_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hide_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"setBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"turnBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"move_s": ["PosString_0", "PosString_1"],
"jump_s": ["PosString_2", "PosString_3"], // 跳跃暂时只考虑终点
"showBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hideBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"setBgFgBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"showFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hideFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"trigger_s": ["PosString_0", "PosString_1"],
"insert_2_s": ["PosString_0", "PosString_1", "IdString_0"],
"animate_s": ["EvalString_0", "EvalString_0"],
"setViewport_s": ["PosString_0", "PosString_1"]
}
editor_blockly.selectPoint = function () {
var block = Blockly.selected, arr = null;
var floorId = editor.currentFloorId, pos = editor.pos, x = pos.x, y = pos.y;
if (block != null && block.type in selectPointBlocks) {
arr = selectPointBlocks[block.type];
if (block != null && MotaActionBlocks[block.type].selectPoint) {
arr = eval(MotaActionBlocks[block.type].selectPoint);
var xv = parseInt(block.getFieldValue(arr[0])), yv = parseInt(block.getFieldValue(arr[1]));
if (block.type == 'animate_s') {
var v = block.getFieldValue(arr[0]).split(",");