Merge pull request #116 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-05-09 15:27:23 +08:00 committed by GitHub
commit a7694fe6f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 225 additions and 165 deletions

View File

@ -6,7 +6,7 @@ grammar MotaAction;
//事件 事件编辑器入口之一 //事件 事件编辑器入口之一
event_m event_m
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND : '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND
;
/* event_m /* event_m
tooltip : 编辑魔塔的事件 tooltip : 编辑魔塔的事件
@ -23,30 +23,30 @@ var code = {
if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2) code = 'data_asdfefw'; if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2) code = 'data_asdfefw';
code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n'); code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n');
return code; return code;
*/ */;
//加点 事件编辑器入口之一 //加点 事件编辑器入口之一
point_m point_m
: '加点' BGNL? Newline choicesContext+ BEND : '加点' BGNL? Newline choicesContext+ BEND
;
/* point_m /* point_m
tooltip : 加点事件 tooltip : 加点事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%8a%a0%e7%82%b9%e4%ba%8b%e4%bb%b6 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%8a%a0%e7%82%b9%e4%ba%8b%e4%bb%b6
var code = '{"type": "choices", "choices": [\n'+choicesContext_0+']}\n'; var code = '{"type": "choices", "choices": [\n'+choicesContext_0+']}\n';
return code; return code;
*/ */;
//商店 事件编辑器入口之一 //商店 事件编辑器入口之一
shop_m shop_m
: '全局商店列表' BGNL? Newline shoplist+ : '全局商店列表' BGNL? Newline shoplist+
;
/* shop_m /* shop_m
tooltip : 全局商店列表 tooltip : 全局商店列表
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
var code = '['+shoplist_0+']\n'; var code = '['+shoplist_0+']\n';
return code; return code;
*/ */;
shoplist shoplist
: shopsub : shopsub
@ -55,16 +55,16 @@ shoplist
emptyshop emptyshop
: Newline : Newline
;
/* emptyshop /* emptyshop
var code = ' \n'; var code = ' \n';
return code; return code;
*/ */;
shopsub shopsub
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND : '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString BGNL? Newline '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
;
/* shopsub /* shopsub
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值 tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
@ -82,11 +82,11 @@ var code = {
} }
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n')+',\n'; code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n')+',\n';
return code; return code;
*/ */;
shopChoices shopChoices
: '商店选项' EvalString '消耗' EvalString? BGNL? Newline shopEffect+ : '商店选项' EvalString '消耗' EvalString? BGNL? Newline shopEffect+
;
/* shopChoices /* shopChoices
tooltip : 商店选项,商店消耗是-1时,这里的消耗对应各自选项的消耗,商店消耗不是-1时这里的消耗不填 tooltip : 商店选项,商店消耗是-1时,这里的消耗对应各自选项的消耗,商店消耗不是-1时这里的消耗不填
@ -96,70 +96,70 @@ colour : this.subColor
EvalString_1 = EvalString_1 && (', "need": "'+EvalString_1+'"'); EvalString_1 = EvalString_1 && (', "need": "'+EvalString_1+'"');
var code = '{"text": "'+EvalString_0+'"'+EvalString_1+', "effect": "'+shopEffect_0.slice(2,-1)+'"},\n'; var code = '{"text": "'+EvalString_0+'"'+EvalString_1+', "effect": "'+shopEffect_0.slice(2,-1)+'"},\n';
return code; return code;
*/ */;
shopEffect shopEffect
: idString_e '+=' expression : idString_e '+=' expression
;
/* shopEffect /* shopEffect
colour : this.subColor colour : this.subColor
var code = idString_e_0+'+='+expression_0+';' var code = idString_e_0+'+='+expression_0+';'
return code; return code;
*/ */;
//afterBattle 事件编辑器入口之一 //afterBattle 事件编辑器入口之一
afterBattle_m afterBattle_m
: '战斗结束后' BGNL? Newline action+ BEND : '战斗结束后' BGNL? Newline action+ BEND
;
/* afterBattle_m /* afterBattle_m
tooltip : 系统引发的自定义事件 tooltip : 系统引发的自定义事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n'; var code = '[\n'+action_0+']\n';
return code; return code;
*/ */;
//afterGetItem 事件编辑器入口之一 //afterGetItem 事件编辑器入口之一
afterGetItem_m afterGetItem_m
: '获取道具后' BGNL? Newline action+ BEND : '获取道具后' BGNL? Newline action+ BEND
;
/* afterGetItem_m /* afterGetItem_m
tooltip : 系统引发的自定义事件 tooltip : 系统引发的自定义事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n'; var code = '[\n'+action_0+']\n';
return code; return code;
*/ */;
//afterOpenDoor 事件编辑器入口之一 //afterOpenDoor 事件编辑器入口之一
afterOpenDoor_m afterOpenDoor_m
: '打开门后' BGNL? Newline action+ BEND : '打开门后' BGNL? Newline action+ BEND
;
/* afterOpenDoor_m /* afterOpenDoor_m
tooltip : 系统引发的自定义事件 tooltip : 系统引发的自定义事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n'; var code = '[\n'+action_0+']\n';
return code; return code;
*/ */;
//firstArrive 事件编辑器入口之一 //firstArrive 事件编辑器入口之一
firstArrive_m firstArrive_m
: '首次到达楼层' BGNL? Newline action+ BEND : '首次到达楼层' BGNL? Newline action+ BEND
;
/* firstArrive_m /* firstArrive_m
tooltip : 首次到达楼层 tooltip : 首次到达楼层
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n'; var code = '[\n'+action_0+']\n';
return code; return code;
*/ */;
//changeFloor 事件编辑器入口之一 //changeFloor 事件编辑器入口之一
changeFloor_m changeFloor_m
: '楼梯, 传送门' BGNL? Newline '目标楼层' IdString Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND : '楼梯, 传送门' BGNL? Newline '目标楼层' IdString Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND
;
/* changeFloor_m /* changeFloor_m
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置 tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
@ -172,7 +172,7 @@ Int_0 = Int_0 ?(', "time": '+Int_0):'';
Bool_0 = Bool_0 ?'':(', "portalWithoutTrigger": false'); Bool_0 = Bool_0 ?'':(', "portalWithoutTrigger": false');
var code = '{"floorId": "'+IdString_0+'"'+loc+DirectionEx_List_0+Int_0+Bool_0+' }\n'; var code = '{"floorId": "'+IdString_0+'"'+loc+DirectionEx_List_0+Int_0+Bool_0+' }\n';
return code; return code;
*/ */;
//为了避免关键字冲突,全部加了_s //为了避免关键字冲突,全部加了_s
//动作 //动作
@ -221,6 +221,9 @@ action
| win_s | win_s
| lose_s | lose_s
| if_s | if_s
| while_s
| break_s
| continue_s
| input_s | input_s
| choices_s | choices_s
| function_s | function_s
@ -229,7 +232,7 @@ action
text_0_s text_0_s
: '显示文章' ':' EvalString Newline : '显示文章' ':' EvalString Newline
;
/* text_0_s /* text_0_s
tooltip : text显示一段文字剧情 tooltip : text显示一段文字剧情
@ -237,11 +240,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=text%ef%bc%9a%e6%98%be%e7
default : ["欢迎使用事件编辑器(双击方块进入多行编辑)"] default : ["欢迎使用事件编辑器(双击方块进入多行编辑)"]
var code = '"'+EvalString_0+'",\n'; var code = '"'+EvalString_0+'",\n';
return code; return code;
*/ */;
text_1_s text_1_s
: '标题' EvalString? '图像' IdString? '对话框效果' EvalString? ':' EvalString Newline : '标题' EvalString? '图像' IdString? '对话框效果' EvalString? ':' EvalString Newline
;
/* text_1_s /* text_1_s
tooltip : text显示一段文字剧情,选项较多请右键点击帮助 tooltip : text显示一段文字剧情,选项较多请右键点击帮助
@ -261,11 +264,11 @@ if(EvalString_1 && !(/^(up|down)(,hero)?(,([+-]?\d+),([+-]?\d+))?$/.test(EvalStr
EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']'); EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']');
var code = '"'+title+EvalString_1+EvalString_2+'",\n'; var code = '"'+title+EvalString_1+EvalString_2+'",\n';
return code; return code;
*/ */;
autoText_s autoText_s
: '自动剧情文本: 标题' EvalString? '图像' IdString? '对话框效果' EvalString? '时间' Int BGNL? EvalString Newline : '自动剧情文本: 标题' EvalString? '图像' IdString? '对话框效果' EvalString? '时间' Int BGNL? EvalString Newline
;
/* autoText_s /* autoText_s
tooltip : autoText自动剧情文本,用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示 tooltip : autoText自动剧情文本,用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示
@ -285,11 +288,11 @@ if(EvalString_1 && !(/^(up|down)(,hero)?(,([+-]?\d+),([+-]?\d+))?$/.test(EvalStr
EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']'); EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']');
var code = '{"type": "autoText", "text": "'+title+EvalString_1+EvalString_2+'", "time" :'+Int_0+'},\n'; var code = '{"type": "autoText", "text": "'+title+EvalString_1+EvalString_2+'", "time" :'+Int_0+'},\n';
return code; return code;
*/ */;
setText_s setText_s
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_1_List '打字间隔' EvalString? Newline : '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? BGNL? '粗体' B_1_List '打字间隔' EvalString? Newline
;
/* setText_s /* setText_s
tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填 tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
@ -316,11 +319,11 @@ if (EvalString_3) {
B_1_List_0 = ', "bold": '+B_1_List_0; B_1_List_0 = ', "bold": '+B_1_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+'},\n'; var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+'},\n';
return code; return code;
*/ */;
tip_s tip_s
: '显示提示' ':' EvalString Newline : '显示提示' ':' EvalString Newline
;
/* tip_s /* tip_s
tooltip : tip显示一段提示文字 tooltip : tip显示一段提示文字
@ -328,11 +331,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=tip%ef%bc%9a%e6%98%be%e7%
default : ["这段话将在左上角以气泡形式显示"] default : ["这段话将在左上角以气泡形式显示"]
var code = '{"type": "tip", "text": "'+EvalString_0+'"},\n'; var code = '{"type": "tip", "text": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
setValue_s setValue_s
: '变量操作' ':' '名称' idString_e '值' expression Newline : '变量操作' ':' '名称' idString_e '值' expression Newline
;
/* setValue_s /* setValue_s
tooltip : setValue设置勇士的某个属性、道具个数, 或某个变量/Flag的值 tooltip : setValue设置勇士的某个属性、道具个数, 或某个变量/Flag的值
@ -340,11 +343,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=text%ef%bc%9a%e6%98%be%e7
colour : this.dataColor colour : this.dataColor
var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n'; var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n';
return code; return code;
*/ */;
show_s show_s
: '显示事件' 'x' EvalString ',' 'y' EvalString '楼层' IdString? '动画时间' Int? Newline : '显示事件' 'x' EvalString ',' 'y' EvalString '楼层' IdString? '动画时间' Int? Newline
;
/* show_s /* show_s
tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点 tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点
@ -368,11 +371,11 @@ if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "show", "loc": ['+EvalString_0.join(',')+']'+IdString_0+''+Int_0+'},\n'; var code = '{"type": "show", "loc": ['+EvalString_0.join(',')+']'+IdString_0+''+Int_0+'},\n';
return code; return code;
*/ */;
hide_s hide_s
: '隐藏事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? Newline : '隐藏事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? Newline
;
/* hide_s /* hide_s
tooltip : hide: 将一个启用事件禁用,所有参数均可不填,代表禁用事件自身,xy可用逗号分隔表示多个点 tooltip : hide: 将一个启用事件禁用,所有参数均可不填,代表禁用事件自身,xy可用逗号分隔表示多个点
@ -400,11 +403,11 @@ IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "hide"'+floorstr+IdString_0+''+Int_0+'},\n'; var code = '{"type": "hide"'+floorstr+IdString_0+''+Int_0+'},\n';
return code; return code;
*/ */;
trigger_s trigger_s
: '触发事件' 'x' PosString ',' 'y' PosString Newline : '触发事件' 'x' PosString ',' 'y' PosString Newline
;
/* trigger_s /* trigger_s
tooltip : trigger: 立即触发另一个地点的事件 tooltip : trigger: 立即触发另一个地点的事件
@ -413,11 +416,11 @@ default : ["0","0"]
colour : this.eventColor colour : this.eventColor
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n'; var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
*/ */;
revisit_s revisit_s
: '重启当前事件' Newline : '重启当前事件' Newline
;
/* revisit_s /* revisit_s
tooltip : revisit: 立即重启当前事件 tooltip : revisit: 立即重启当前事件
@ -425,11 +428,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=revisit-%e7%ab%8b%e5%8d%b
colour : this.eventColor colour : this.eventColor
var code = '{"type": "revisit"},\n'; var code = '{"type": "revisit"},\n';
return code; return code;
*/ */;
exit_s exit_s
: '立刻结束当前事件' Newline : '立刻结束当前事件' Newline
;
/* exit_s /* exit_s
tooltip : exit: 立刻结束当前事件 tooltip : exit: 立刻结束当前事件
@ -437,11 +440,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=exit-%e7%ab%8b%e5%88%bb%e
colour : this.eventColor colour : this.eventColor
var code = '{"type": "exit"},\n'; var code = '{"type": "exit"},\n';
return code; return code;
*/ */;
setBlock_s setBlock_s
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline : '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
;
/* setBlock_s /* setBlock_s
tooltip : setBlock设置某个图块,忽略坐标楼层则为当前事件 tooltip : setBlock设置某个图块,忽略坐标楼层则为当前事件
@ -455,11 +458,11 @@ if (PosString_0 && PosString_1) {
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n'; var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n';
return code; return code;
*/ */;
setHeroIcon_s setHeroIcon_s
: '更改角色行走图' EvalString? Newline : '更改角色行走图' EvalString? Newline
;
/* setHeroIcon_s /* setHeroIcon_s
tooltip : setHeroIcon更改角色行走图 tooltip : setHeroIcon更改角色行走图
@ -469,11 +472,11 @@ default : ["hero.png"]
EvalString_0 = EvalString_0 && (', "name": "'+EvalString_0+'"'); EvalString_0 = EvalString_0 && (', "name": "'+EvalString_0+'"');
var code = '{"type": "setHeroIcon"'+EvalString_0+'},\n'; var code = '{"type": "setHeroIcon"'+EvalString_0+'},\n';
return code; return code;
*/ */;
update_s update_s
: '更新状态栏和地图显伤' Newline : '更新状态栏和地图显伤' Newline
;
/* update_s /* update_s
tooltip : update: 立刻更新状态栏和地图显伤 tooltip : update: 立刻更新状态栏和地图显伤
@ -481,11 +484,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=update-%e7%ab%8b%e5%88%bb
colour : this.dataColor colour : this.dataColor
var code = '{"type": "update"},\n'; var code = '{"type": "update"},\n';
return code; return code;
*/ */;
sleep_s sleep_s
: '等待' Int '毫秒' Newline : '等待' Int '毫秒' Newline
;
/* sleep_s /* sleep_s
tooltip : sleep: 等待多少毫秒 tooltip : sleep: 等待多少毫秒
@ -494,11 +497,11 @@ default : [500]
colour : this.soundColor colour : this.soundColor
var code = '{"type": "sleep", "time": '+Int_0+'},\n'; var code = '{"type": "sleep", "time": '+Int_0+'},\n';
return code; return code;
*/ */;
wait_s wait_s
: '等待用户操作' : '等待用户操作'
;
/* wait_s /* wait_s
tooltip : wait: 等待用户操作 tooltip : wait: 等待用户操作
@ -506,11 +509,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=wait-%e7%ad%89%e5%be%85%e
colour : this.soundColor colour : this.soundColor
var code = '{"type": "wait"},\n'; var code = '{"type": "wait"},\n';
return code; return code;
*/ */;
battle_s battle_s
: '强制战斗' IdString Newline : '强制战斗' IdString Newline
;
/* battle_s /* battle_s
tooltip : battle: 强制战斗 tooltip : battle: 强制战斗
@ -519,11 +522,11 @@ default : ["greenSlime"]
colour : this.dataColor colour : this.dataColor
var code = '{"type": "battle", "id": "'+IdString_0+'"},\n'; var code = '{"type": "battle", "id": "'+IdString_0+'"},\n';
return code; return code;
*/ */;
openDoor_s openDoor_s
: '开门' 'x' PosString ',' 'y' PosString '楼层' IdString? Newline : '开门' 'x' PosString ',' 'y' PosString '楼层' IdString? Newline
;
/* openDoor_s /* openDoor_s
tooltip : openDoor: 开门,楼层可不填表示当前层 tooltip : openDoor: 开门,楼层可不填表示当前层
@ -533,11 +536,11 @@ colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n'; var code = '{"type": "openDoor", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n';
return code; return code;
*/ */;
changeFloor_s changeFloor_s
: '楼层切换' IdString 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline : '楼层切换' IdString 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline
;
/* changeFloor_s /* changeFloor_s
tooltip : changeFloor: 楼层切换,动画时间可不填 tooltip : changeFloor: 楼层切换,动画时间可不填
@ -548,11 +551,11 @@ DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+PosString_0+', '+PosString_1+']'+DirectionEx_List_0+Int_0+' },\n'; var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'", "loc": ['+PosString_0+', '+PosString_1+']'+DirectionEx_List_0+Int_0+' },\n';
return code; return code;
*/ */;
changePos_0_s changePos_0_s
: '位置切换' 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List Newline : '位置切换' 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List Newline
;
/* changePos_0_s /* changePos_0_s
tooltip : changePos: 当前位置切换 tooltip : changePos: 当前位置切换
@ -562,11 +565,11 @@ colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"'); DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n'; var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n';
return code; return code;
*/ */;
changePos_1_s changePos_1_s
: '勇士转向' Direction_List Newline : '勇士转向' Direction_List Newline
;
/* changePos_1_s /* changePos_1_s
tooltip : changePos: 勇士转向 tooltip : changePos: 勇士转向
@ -575,11 +578,11 @@ colour : this.dataColor
default : [null] default : [null]
var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n'; var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n';
return code; return code;
*/ */;
openShop_s openShop_s
: '打开全局商店' IdString Newline : '打开全局商店' IdString Newline
;
/* openShop_s /* openShop_s
tooltip : 全局商店 tooltip : 全局商店
@ -587,11 +590,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=%e5%85%a8%e5%b1%80%e5%95%
default : ["shop1"] default : ["shop1"]
var code = '{"type": "openShop", "id": "'+IdString_0+'"},\n'; var code = '{"type": "openShop", "id": "'+IdString_0+'"},\n';
return code; return code;
*/ */;
disableShop_s disableShop_s
: '禁用全局商店' IdString Newline : '禁用全局商店' IdString Newline
;
/* disableShop_s /* disableShop_s
tooltip : 全局商店 tooltip : 全局商店
@ -600,11 +603,11 @@ default : ["shop1"]
colour : this.eventColor colour : this.eventColor
var code = '{"type": "disableShop", "id": "'+IdString_0+'"},\n'; var code = '{"type": "disableShop", "id": "'+IdString_0+'"},\n';
return code; return code;
*/ */;
animate_s animate_s
: '显示动画' IdString '位置' EvalString? Newline : '显示动画' IdString '位置' EvalString? Newline
;
/* animate_s /* animate_s
tooltip : animate显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点 tooltip : animate显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点
@ -624,11 +627,11 @@ if (EvalString_0) {
} }
var code = '{"type": "animate", "name": "'+IdString_0+'"'+EvalString_0+'},\n'; var code = '{"type": "animate", "name": "'+IdString_0+'"'+EvalString_0+'},\n';
return code; return code;
*/ */;
showImage_0_s showImage_0_s
: '显示图片' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline : '显示图片' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
;
/* showImage_0_s /* showImage_0_s
tooltip : showImage显示图片 tooltip : showImage显示图片
@ -637,11 +640,11 @@ default : ["bg.jpg","0","0"]
colour : this.printColor colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n'; var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
*/ */;
showImage_1_s showImage_1_s
: '清除所有图片' Newline : '清除所有图片' Newline
;
/* showImage_1_s /* showImage_1_s
tooltip : showImage清除所有显示的图片 tooltip : showImage清除所有显示的图片
@ -649,11 +652,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%
colour : this.printColor colour : this.printColor
var code = '{"type": "showImage"},\n'; var code = '{"type": "showImage"},\n';
return code; return code;
*/ */;
animateImage_0_s animateImage_0_s
: '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline : '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline
;
/* animateImage_0_s /* animateImage_0_s
tooltip : animageImage图片淡入 tooltip : animageImage图片淡入
@ -662,11 +665,11 @@ default : ["bg.jpg","0","0",500]
colour : this.printColor colour : this.printColor
var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n'; var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n';
return code; return code;
*/ */;
animateImage_1_s animateImage_1_s
: '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline : '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int Newline
;
/* animateImage_1_s /* animateImage_1_s
tooltip : animageImage图片淡出 tooltip : animageImage图片淡出
@ -675,11 +678,11 @@ default : ["bg.jpg","0","0",500]
colour : this.printColor colour : this.printColor
var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n'; var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+'},\n';
return code; return code;
*/ */;
showGif_0_s showGif_0_s
: '显示动图' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline : '显示动图' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
;
/* showGif_0_s /* showGif_0_s
tooltip : showGif显示动图 tooltip : showGif显示动图
@ -688,11 +691,11 @@ default : ["bg.gif","0","0"]
colour : this.printColor colour : this.printColor
var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n'; var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code; return code;
*/ */;
showGif_1_s showGif_1_s
: '清除所有动图' Newline : '清除所有动图' Newline
;
/* showGif_1_s /* showGif_1_s
tooltip : showGif清除所有显示的动图 tooltip : showGif清除所有显示的动图
@ -700,12 +703,12 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showgif%ef%bc%9a%e6%98%be
colour : this.printColor colour : this.printColor
var code = '{"type": "showGif"},\n'; var code = '{"type": "showGif"},\n';
return code; return code;
*/ */;
moveImage_0_s moveImage_0_s
: '图片移动' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL : '图片移动' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL
'终点像素位置' 'x' PosString 'y' PosString '移动时间' Int Newline '终点像素位置' 'x' PosString 'y' PosString '移动时间' Int Newline
;
/* moveImage_0_s /* moveImage_0_s
tooltip : moveImage图片移动 tooltip : moveImage图片移动
@ -714,11 +717,11 @@ default : ["bg.jpg","0","0","0","0",500]
colour : this.printColor colour : this.printColor
var code = '{"type": "moveImage", "name": "'+EvalString_0+'", "from": ['+PosString_0+','+PosString_1+'], "to": ['+PosString_2+','+PosString_3+'], "time": '+Int_0+'},\n'; var code = '{"type": "moveImage", "name": "'+EvalString_0+'", "from": ['+PosString_0+','+PosString_1+'], "to": ['+PosString_2+','+PosString_3+'], "time": '+Int_0+'},\n';
return code; return code;
*/ */;
setFg_0_s setFg_0_s
: '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline : '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline
;
/* setFg_0_s /* setFg_0_s
tooltip : setFg: 更改画面色调,动画时间可不填 tooltip : setFg: 更改画面色调,动画时间可不填
@ -737,11 +740,11 @@ Number_3 = limit(Number_3,0,1);
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "setFg", "color": ['+Number_0+','+Number_1+','+Number_2+','+Number_3+']'+Int_0 +'},\n'; var code = '{"type": "setFg", "color": ['+Number_0+','+Number_1+','+Number_2+','+Number_3+']'+Int_0 +'},\n';
return code; return code;
*/ */;
setFg_1_s setFg_1_s
: '恢复画面色调' '动画时间' Int? Newline : '恢复画面色调' '动画时间' Int? Newline
;
/* setFg_1_s /* setFg_1_s
tooltip : setFg: 恢复画面色调,动画时间可不填 tooltip : setFg: 恢复画面色调,动画时间可不填
@ -751,11 +754,11 @@ colour : this.soundColor
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "setFg"'+Int_0 +'},\n'; var code = '{"type": "setFg"'+Int_0 +'},\n';
return code; return code;
*/ */;
setWeather_s setWeather_s
: '更改天气' Weather_List '强度' Int Newline : '更改天气' Weather_List '强度' Int Newline
;
/* setWeather_s /* setWeather_s
tooltip : setWeather更改天气 tooltip : setWeather更改天气
@ -766,11 +769,11 @@ if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间');
var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n'; var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n';
if(Weather_List_0==='')code = '{"type": "setWeather"},\n'; if(Weather_List_0==='')code = '{"type": "setWeather"},\n';
return code; return code;
*/ */;
move_s move_s
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline : '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '消失时无动画时间' Bool BGNL? StepString Newline
;
/* move_s /* move_s
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件 tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
@ -784,11 +787,11 @@ if (PosString_0 && PosString_1) {
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "move"'+floorstr+''+Int_0+', "steps": '+JSON.stringify(StepString_0)+', "immediateHide": '+Bool_0+'},\n'; var code = '{"type": "move"'+floorstr+''+Int_0+', "steps": '+JSON.stringify(StepString_0)+', "immediateHide": '+Bool_0+'},\n';
return code; return code;
*/ */;
moveHero_s moveHero_s
: '移动勇士' '动画时间' Int? BGNL? StepString Newline : '移动勇士' '动画时间' Int? BGNL? StepString Newline
;
/* moveHero_s /* moveHero_s
tooltip : moveHero移动勇士,用这种方式移动勇士的过程中将无视一切地形, 无视一切事件, 中毒状态也不会扣血 tooltip : moveHero移动勇士,用这种方式移动勇士的过程中将无视一切地形, 无视一切事件, 中毒状态也不会扣血
@ -798,11 +801,11 @@ colour : this.dataColor
Int_0 = Int_0 ?(', "time": '+Int_0):''; Int_0 = Int_0 ?(', "time": '+Int_0):'';
var code = '{"type": "moveHero"'+Int_0+', "steps": '+JSON.stringify(StepString_0)+'},\n'; var code = '{"type": "moveHero"'+Int_0+', "steps": '+JSON.stringify(StepString_0)+'},\n';
return code; return code;
*/ */;
playBgm_s playBgm_s
: '播放背景音乐' EvalString Newline : '播放背景音乐' EvalString Newline
;
/* playBgm_s /* playBgm_s
tooltip : playBgm: 播放背景音乐 tooltip : playBgm: 播放背景音乐
@ -811,11 +814,11 @@ default : ["bgm.mp3"]
colour : this.soundColor colour : this.soundColor
var code = '{"type": "playBgm", "name": "'+EvalString_0+'"},\n'; var code = '{"type": "playBgm", "name": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
pauseBgm_s pauseBgm_s
: '暂停背景音乐' Newline : '暂停背景音乐' Newline
;
/* pauseBgm_s /* pauseBgm_s
tooltip : pauseBgm: 暂停背景音乐 tooltip : pauseBgm: 暂停背景音乐
@ -823,11 +826,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=pausebgm-%e6%9a%82%e5%81%
colour : this.soundColor colour : this.soundColor
var code = '{"type": "pauseBgm"},\n'; var code = '{"type": "pauseBgm"},\n';
return code; return code;
*/ */;
resumeBgm_s resumeBgm_s
: '恢复背景音乐' Newline : '恢复背景音乐' Newline
;
/* resumeBgm_s /* resumeBgm_s
tooltip : resumeBgm: 恢复背景音乐 tooltip : resumeBgm: 恢复背景音乐
@ -835,11 +838,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=resumebgm-%e6%81%a2%e5%a4
colour : this.soundColor colour : this.soundColor
var code = '{"type": "resumeBgm"},\n'; var code = '{"type": "resumeBgm"},\n';
return code; return code;
*/ */;
playSound_s playSound_s
: '播放音效' EvalString Newline : '播放音效' EvalString Newline
;
/* playSound_s /* playSound_s
tooltip : playSound: 播放音效 tooltip : playSound: 播放音效
@ -848,11 +851,11 @@ default : ["item.ogg"]
colour : this.soundColor colour : this.soundColor
var code = '{"type": "playSound", "name": "'+EvalString_0+'"},\n'; var code = '{"type": "playSound", "name": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
setVolume_s setVolume_s
: '设置音量' Int Newline : '设置音量' Int Newline
;
/* setVolume_s /* setVolume_s
tooltip : setVolume: 设置音量 tooltip : setVolume: 设置音量
@ -861,11 +864,11 @@ default : [90]
colour : this.soundColor colour : this.soundColor
var code = '{"type": "setVolume", "value": '+Int_0+'},\n'; var code = '{"type": "setVolume", "value": '+Int_0+'},\n';
return code; return code;
*/ */;
win_s win_s
: '游戏胜利,结局' ':' EvalString? Newline : '游戏胜利,结局' ':' EvalString? Newline
;
/* win_s /* win_s
tooltip : win: 获得胜利, 该事件会显示获胜页面, 并重新游戏 tooltip : win: 获得胜利, 该事件会显示获胜页面, 并重新游戏
@ -873,11 +876,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=win-%e8%8e%b7%e5%be%97%e8
default : [""] default : [""]
var code = '{"type": "win", "reason": "'+EvalString_0+'"},\n'; var code = '{"type": "win", "reason": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
lose_s lose_s
: '游戏失败,结局' ':' EvalString? Newline : '游戏失败,结局' ':' EvalString? Newline
;
/* lose_s /* lose_s
tooltip : lose: 游戏失败, 该事件会显示失败页面, 并重新开始游戏 tooltip : lose: 游戏失败, 该事件会显示失败页面, 并重新开始游戏
@ -885,11 +888,11 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=lose-%e6%b8%b8%e6%88%8f%e
default : [""] default : [""]
var code = '{"type": "lose", "reason": "'+EvalString_0+'"},\n'; var code = '{"type": "lose", "reason": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
input_s input_s
: '接受用户输入,提示' ':' EvalString Newline : '接受用户输入,提示' ':' EvalString Newline
;
/* input_s /* input_s
tooltip : input接受用户输入, 事件只能接受非负整数输入, 所有非法的输入将全部变成0 tooltip : input接受用户输入, 事件只能接受非负整数输入, 所有非法的输入将全部变成0
@ -898,11 +901,11 @@ default : ["请输入一个数"]
colour : this.dataColor colour : this.dataColor
var code = '{"type": "input", "text": "'+EvalString_0+'"},\n'; var code = '{"type": "input", "text": "'+EvalString_0+'"},\n';
return code; return code;
*/ */;
if_s if_s
: '如果' ':' expression BGNL? Newline action+ '否则' ':' BGNL? Newline action+ BEND Newline : '如果' ':' expression BGNL? Newline action+ '否则' ':' BGNL? Newline action+ BEND Newline
;
/* if_s /* if_s
tooltip : if: 条件判断 tooltip : if: 条件判断
@ -913,11 +916,46 @@ var code = ['{"type": "if", "condition": "',expression_0,'",\n',
'"false": [\n',action_1,']\n', '"false": [\n',action_1,']\n',
'},\n'].join(''); '},\n'].join('');
return code; return code;
*/ */;
while_s
: '循环处理' '' '当' expression '时' BGNL? Newline action+ BEND Newline
/* while_s
tooltip : while循环处理
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=while%EF%BC%9A%E5%BE%AA%E7%8E%AF%E5%A4%84%E7%90%86
colour : this.eventColor
var code = ['{"type": "while", "condition": "',expression_0,'",\n',
'"data": [\n',action_0,'],\n',
'},\n'].join('');
return code;
*/;
break_s
: '跳出循环' Newline
/* break_s
tooltip : break跳出循环, 如果break事件不在任何循环中被执行则和exit等价即会立刻结束当前事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=break%EF%BC%9A%E8%B7%B3%E5%87%BA%E5%BE%AA%E7%8E%AF
colour : this.eventColor
var code = '{"type": "break"},\n';
return code;
*/;
continue_s
: '继续当前循环' Newline
/* continue_s
tooltip : continue继续执行当前循环的下一轮, 如果continue事件不在任何循环中被执行则和exit等价即会立刻结束当前事件
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=continue%EF%BC%9A%E7%BB%A7%E7%BB%AD%E6%89%A7%E8%A1%8C%E5%BD%93%E5%89%8D%E5%BE%AA%E7%8E%AF
colour : this.eventColor
var code = '{"type": "continue"},\n';
return code;
*/;
choices_s choices_s
: '选项' ':' EvalString? BGNL? '标题' EvalString? '图像' IdString? BGNL? Newline choicesContext+ BEND Newline : '选项' ':' EvalString? BGNL? '标题' EvalString? '图像' IdString? BGNL? Newline choicesContext+ BEND Newline
;
/* choices_s /* choices_s
tooltip : choices: 给用户提供选项 tooltip : choices: 给用户提供选项
@ -937,11 +975,11 @@ var code = ['{"type": "choices"',EvalString_0,', "choices": [\n',
choicesContext_0, choicesContext_0,
']},\n'].join(''); ']},\n'].join('');
return code; return code;
*/ */;
choicesContext choicesContext
: '子选项' EvalString BGNL? Newline action+ : '子选项' EvalString BGNL? Newline action+
;
/* choicesContext /* choicesContext
tooltip : 选项的选择 tooltip : 选项的选择
@ -950,11 +988,11 @@ default : ["提示文字:红钥匙"]
colour : this.subColor colour : this.subColor
var code = '{"text": "'+EvalString_0+'", "action": [\n'+action_0+']},\n'; var code = '{"text": "'+EvalString_0+'", "action": [\n'+action_0+']},\n';
return code; return code;
*/ */;
function_s function_s
: '自定义JS脚本' BGNL? Newline RawEvalString Newline BEND Newline : '自定义JS脚本' BGNL? Newline RawEvalString Newline BEND Newline
;
/* function_s /* function_s
tooltip : function: 自定义JS脚本 tooltip : function: 自定义JS脚本
@ -963,16 +1001,16 @@ default : ["alert(core.getStatus(\"atk\"));"]
colour : this.dataColor colour : this.dataColor
var code = '{"type": "function", "function": "function(){\\n'+JSON.stringify(RawEvalString_0).slice(1,-1).split('\\\\n').join('\\n')+'\\n}"},\n'; var code = '{"type": "function", "function": "function(){\\n'+JSON.stringify(RawEvalString_0).slice(1,-1).split('\\\\n').join('\\n')+'\\n}"},\n';
return code; return code;
*/ */;
pass_s pass_s
: Newline : Newline
;
/* pass_s /* pass_s
var code = ' \n'; var code = ' \n';
return code; return code;
*/ */;
statExprSplit : '=== statement ^ === expression v ===' ; statExprSplit : '=== statement ^ === expression v ===' ;
//===blockly表达式=== //===blockly表达式===
@ -983,7 +1021,7 @@ expression
| bool_e | bool_e
| idString_e | idString_e
| evalString_e | evalString_e
;
/* expression_arithmetic_0 /* expression_arithmetic_0
//todo 修改recieveOrder,根据Arithmetic_List_0不同的值设定不同的recieveOrder //todo 修改recieveOrder,根据Arithmetic_List_0不同的值设定不同的recieveOrder
@ -1010,43 +1048,43 @@ var orders = {
'或': Blockly.JavaScript.ORDER_LOGICAL_OR '或': Blockly.JavaScript.ORDER_LOGICAL_OR
} }
return [code, orders[Arithmetic_List_0]]; return [code, orders[Arithmetic_List_0]];
*/ */;
negate_e negate_e
: '非' expression : '非' expression
;
/* negate_e /* negate_e
//todo 修改recieveOrder : ORDER_LOGICAL_NOT 修改 inputsInline //todo 修改recieveOrder : ORDER_LOGICAL_NOT 修改 inputsInline
var code = '!'+expression_0; var code = '!'+expression_0;
return [code, Blockly.JavaScript.ORDER_LOGICAL_NOT]; return [code, Blockly.JavaScript.ORDER_LOGICAL_NOT];
*/ */;
bool_e bool_e
: Bool : Bool
;
/* bool_e /* bool_e
var code = Bool_0; var code = Bool_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/ */;
idString_e idString_e
: IdString : IdString
;
/* idString_e /* idString_e
colour : this.idstring_eColor colour : this.idstring_eColor
default : ["status:hp"] default : ["status:hp"]
var code = IdString_0; var code = IdString_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/ */;
//这一条不会被antlr识别,总是会被归到idString_e //这一条不会被antlr识别,总是会被归到idString_e
idString_1_e idString_1_e
: Id_List ':' IdText : Id_List ':' IdText
;
/* idString_1_e /* idString_1_e
colour : this.idstring_eColor colour : this.idstring_eColor
@ -1054,29 +1092,29 @@ default : [null,"自定义flag"]
//todo 将其output改成'idString_e' //todo 将其output改成'idString_e'
var code = Id_List_0+':'+IdText_0; var code = Id_List_0+':'+IdText_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/ */;
//这一条不会被antlr识别,总是会被归到idString_e //这一条不会被antlr识别,总是会被归到idString_e
idString_2_e idString_2_e
: FixedId_List : FixedId_List
;
/* idString_2_e /* idString_2_e
colour : this.idstring_eColor colour : this.idstring_eColor
//todo 将其output改成'idString_e' //todo 将其output改成'idString_e'
var code = FixedId_List_0; var code = FixedId_List_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/ */;
evalString_e evalString_e
: EvalString : EvalString
;
/* evalString_e /* evalString_e
default : ["值"] default : ["值"]
var code = EvalString_0; var code = EvalString_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/ */;
//===============lexer=============== //===============lexer===============
@ -1516,6 +1554,20 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['choices_s'].xmlText([ this.next = MotaActionBlocks['choices_s'].xmlText([
this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]); this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]);
break; break;
case "while": // 循环处理
this.next = MotaActionBlocks['while_s'].xmlText([
MotaActionBlocks['evalString_e'].xmlText([data.condition]),
this.insertActionList(data["data"]),
this.next]);
break;
case "break": // 跳出循环
this.next = MotaActionBlocks['break_s'].xmlText([
this.next]);
break;
case "continue": // 继续执行当前循环
this.next = MotaActionBlocks['continue_s'].xmlText([
this.next]);
break;
case "win": case "win":
this.next = MotaActionBlocks['win_s'].xmlText([ this.next = MotaActionBlocks['win_s'].xmlText([
data.reason,this.next]); data.reason,this.next]);

View File

@ -94,6 +94,9 @@ editor_blockly = function () {
MotaActionBlocks['setHeroIcon_s'].xmlText(), MotaActionBlocks['setHeroIcon_s'].xmlText(),
'<label text="事件控制"></label>', '<label text="事件控制"></label>',
MotaActionBlocks['if_s'].xmlText(), MotaActionBlocks['if_s'].xmlText(),
MotaActionBlocks['while_s'].xmlText(),
MotaActionBlocks['break_s'].xmlText(),
MotaActionBlocks['continue_s'].xmlText(),
MotaActionBlocks['revisit_s'].xmlText(), MotaActionBlocks['revisit_s'].xmlText(),
MotaActionBlocks['exit_s'].xmlText(), MotaActionBlocks['exit_s'].xmlText(),
MotaActionBlocks['show_s'].xmlText(), MotaActionBlocks['show_s'].xmlText(),

View File

@ -116,18 +116,23 @@ editor_file = function (editor, callback) {
throw('未设置callback') throw('未设置callback')
} }
; ;
if (!isset(editor.currentFloorData)) { var currData=editor.currentFloorData;
callback('无数据'); var saveStatus = document.getElementById('newMapStatus').checked;
}
editor.currentFloorData = { editor.currentFloorData = {
floorId: saveFilename, floorId: saveFilename,
title: "新建楼层", title: saveStatus?currData.title:"新建楼层",
name: "0", name: saveStatus?currData.name:"0",
canFlyTo: true, canFlyTo: saveStatus?currData.canFlyTo:true,
canUseQuickShop: true, canUseQuickShop: saveStatus?currData.canUseQuickShop:true,
cannotViewMap: false, cannotViewMap: saveStatus?currData.cannotViewMap:false,
images: [], images: [],
item_ratio: 1, item_ratio: saveStatus?currData.item_ratio:1,
defaultGround: saveStatus?currData.defaultGround:"ground",
bgm: saveStatus?currData.bgm:null,
upFloor: null,
downFloor: null,
color: saveStatus?currData.color:null,
weather: saveStatus?currData.weather:null,
firstArrive: [], firstArrive: [],
events: {}, events: {},
changeFloor: {}, changeFloor: {},
@ -136,6 +141,10 @@ editor_file = function (editor, callback) {
afterOpenDoor: {}, afterOpenDoor: {},
cannotMove: {} cannotMove: {}
}; };
Object.keys(editor.currentFloorData).forEach(function (t) {
if (!core.isset(editor.currentFloorData[t]))
delete editor.currentFloorData[t];
})
editor.currentFloorData.map = "new"; editor.currentFloorData.map = "new";
editor.currentFloorId = saveFilename; editor.currentFloorId = saveFilename;
editor_file.saveFloorFile(callback); editor_file.saveFloorFile(callback);

View File

@ -1091,24 +1091,6 @@ choices为一个数组其中每一项都是一个选项列表。
使用 `{"type": "break"}` 可以跳出当前循环。 使用 `{"type": "break"}` 可以跳出当前循环。
上面的输出例子也可以这么写:
``` js
"x,y": [ // 实际执行的事件列表
{"type":"while", "condition": "true", // 循环处理;永远为真
"data":[
{"type": "setValue", "name": "flag:i", "value": "flag:i+1"}, // 递增i
{"type": "if", "condition": "flag:i>10", // 测试i是否超过了10
"true": [{"type": "break"}], // 是的则直接break调出循环
"false": []
},
"${flag:i}", // 输出i
{"type": "sleep","time":1000}, // 等待1秒
]
},
]
```
!> 如果break事件不在任何循环中被执行则和exit等价即会立刻结束当前事件 !> 如果break事件不在任何循环中被执行则和exit等价即会立刻结束当前事件
### continue继续执行当前循环 ### continue继续执行当前循环

View File

@ -20,7 +20,9 @@
</div> </div>
<div id="editTip"> <div id="editTip">
<input type="button" value="新建空白地图" id='newMap'/> <input type="button" value="新建空白地图" id='newMap'/>
<input id='newFileName' placeholder="输入新楼层id"/> <input id='newFileName' placeholder="输入新楼层id" style="width: 120px"/>
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
</div> </div>
<div style="position: absolute;left: 10px;bottom:0; margin-bottom: 90px"> <div style="position: absolute;left: 10px;bottom:0; margin-bottom: 90px">
<input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/> <input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/>

View File

@ -1,4 +1,16 @@
HTML5魔塔样板V2.2 HTML5魔塔样板V2.2.1
衰弱减少攻防的比例 √
while循环事件 √
地图数据统计
最大存档个数提到main处理 √
新建地图可以保留楼层属性 √
装备的教程
部分Bug修复 √
-----------------------------------------------------------------------
HTML5魔塔样板V2.2
事件坐标可用变量指定("loc": ["flag:x", "flag:y"]) 事件坐标可用变量指定("loc": ["flag:x", "flag:y"])
全局商店也可以使用图块编辑 全局商店也可以使用图块编辑