shop_event & unknow_event
This commit is contained in:
parent
3568fc11b7
commit
6e5e8f46ab
@ -682,12 +682,6 @@ revisit常常使用在一些商人之类的地方,当用户购买物品后不
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### addToList:将本公共事件插入到快捷列表中
|
|
||||||
|
|
||||||
使用 `{"type": "addToList"}` 可以将当前公共事件插入到快捷商店列表中。
|
|
||||||
|
|
||||||
此项只能在公共事件中被执行。详见[公共事件](personalization#公共事件)。
|
|
||||||
|
|
||||||
### setBlock:设置某个图块
|
### setBlock:设置某个图块
|
||||||
|
|
||||||
我们可以采用 `{"type": "setBlock"}` 来改变某个地图块。
|
我们可以采用 `{"type": "setBlock"}` 来改变某个地图块。
|
||||||
|
|||||||
@ -65,6 +65,7 @@ return code;
|
|||||||
|
|
||||||
shoplist
|
shoplist
|
||||||
: shopsub
|
: shopsub
|
||||||
|
| shopcommonevent
|
||||||
| emptyshop
|
| emptyshop
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -77,6 +78,24 @@ var code = ' \n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
shopcommonevent
|
||||||
|
: '商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' EvalString?
|
||||||
|
|
||||||
|
/* shopcommonevent
|
||||||
|
tooltip : 全局商店, 执行一个公共事件
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/
|
||||||
|
default : ["shop1","回收钥匙商店",false,"回收钥匙商店",""]
|
||||||
|
var code = {
|
||||||
|
'id': IdString_0,
|
||||||
|
'textInList': EvalString_0,
|
||||||
|
'mustEnable': Bool_0,
|
||||||
|
'commonEvent': EvalString_1,
|
||||||
|
'args': EvalString_2
|
||||||
|
}
|
||||||
|
code=JSON.stringify(code,null,2)+',\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
shopsub
|
shopsub
|
||||||
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
|
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
|
||||||
|
|
||||||
@ -240,7 +259,6 @@ action
|
|||||||
| insert_2_s
|
| insert_2_s
|
||||||
| revisit_s
|
| revisit_s
|
||||||
| exit_s
|
| exit_s
|
||||||
| addToList_s
|
|
||||||
| setBlock_s
|
| setBlock_s
|
||||||
| showFloorImg_s
|
| showFloorImg_s
|
||||||
| hideFloorImg_s
|
| hideFloorImg_s
|
||||||
@ -304,6 +322,7 @@ action
|
|||||||
| callBook_s
|
| callBook_s
|
||||||
| callSave_s
|
| callSave_s
|
||||||
| callLoad_s
|
| callLoad_s
|
||||||
|
| unknow_s
|
||||||
| function_s
|
| function_s
|
||||||
| pass_s
|
| pass_s
|
||||||
;
|
;
|
||||||
@ -694,18 +713,6 @@ var code = '{"type": "exit"},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
addToList_s
|
|
||||||
: '将本公共事件插入到快捷列表中' Newline
|
|
||||||
|
|
||||||
|
|
||||||
/* addToList_s
|
|
||||||
tooltip : addToList: 将本公共事件插入到快捷列表中
|
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=exit%EF%BC%9A%E7%AB%8B%E5%88%BB%E7%BB%93%E6%9D%9F%E5%BD%93%E5%89%8D%E4%BA%8B%E4%BB%B6
|
|
||||||
colour : this.eventColor
|
|
||||||
var code = '{"type": "addToList"},\n';
|
|
||||||
return code;
|
|
||||||
*/;
|
|
||||||
|
|
||||||
setBlock_s
|
setBlock_s
|
||||||
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
|
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
|
||||||
|
|
||||||
@ -1739,6 +1746,19 @@ var code = '{"type": "callLoad"},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
unknow_s
|
||||||
|
: '自定义事件' BGNL? RawEvalString
|
||||||
|
|
||||||
|
/* unknow_s
|
||||||
|
tooltip : 通过脚本自定义的事件类型, 以及编辑器不识别的事件类型
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/
|
||||||
|
default : ['{"type":"eventType1"}']
|
||||||
|
colour : this.dataColor
|
||||||
|
var tempobj={};
|
||||||
|
eval("tempobj='"+RawEvalString_0+"'");
|
||||||
|
var code = tempobj +',\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
function_s
|
function_s
|
||||||
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
|
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
|
||||||
@ -2127,10 +2147,21 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
|
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
var buildcommentevent = function(obj,parser,next){
|
||||||
|
return MotaActionBlocks['shopcommonevent'].xmlText([
|
||||||
|
obj.id,parser.EvalString(obj.textInList),obj.mustEnable,parser.EvalString(obj.commonEvent),parser.EvalString(obj.args),next
|
||||||
|
]);
|
||||||
|
}
|
||||||
var next=null;
|
var next=null;
|
||||||
if(!obj)obj=[];
|
if(!obj)obj=[];
|
||||||
while(obj.length){
|
while(obj.length){
|
||||||
next=buildsub(obj.pop(),this,next);
|
var shopobj=obj.pop()
|
||||||
|
if(shopobj.choices)
|
||||||
|
next=buildsub(shopobj,this,next);
|
||||||
|
else if(shopobj.commonEvent)
|
||||||
|
next=buildcommentevent(shopobj,this,next);
|
||||||
|
else
|
||||||
|
throw new Error("[警告]出错啦!\n"+shopobj.id+" 无效的商店");
|
||||||
}
|
}
|
||||||
return MotaActionBlocks['shop_m'].xmlText([next]);
|
return MotaActionBlocks['shop_m'].xmlText([next]);
|
||||||
|
|
||||||
@ -2617,14 +2648,16 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
this.next = MotaActionBlocks['exit_s'].xmlText([
|
this.next = MotaActionBlocks['exit_s'].xmlText([
|
||||||
this.next]);
|
this.next]);
|
||||||
break;
|
break;
|
||||||
case "addToList": // 立刻结束事件
|
|
||||||
this.next = MotaActionBlocks['addToList_s'].xmlText([
|
|
||||||
this.next]);
|
|
||||||
break;
|
|
||||||
case "animateImage": // 兼容 animateImage
|
case "animateImage": // 兼容 animateImage
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持...");
|
var rawdata = JSON.stringify(data,function(k,v){
|
||||||
|
if(typeof(v)=='string')return v.split('\n').join('\\n');
|
||||||
|
else return v;
|
||||||
|
},2);
|
||||||
|
rawdata=rawdata.split('\n').join('\\n');
|
||||||
|
this.next = MotaActionBlocks['unknow_s'].xmlText([
|
||||||
|
rawdata,this.next]);
|
||||||
}
|
}
|
||||||
this.parseAction();
|
this.parseAction();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -660,12 +660,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"_bool": "bool",
|
"_bool": "bool",
|
||||||
"_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。"
|
"_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。"
|
||||||
},
|
},
|
||||||
"quickCommonEvents": {
|
|
||||||
"_leaf": true,
|
|
||||||
"_type": "checkbox",
|
|
||||||
"_bool": "bool",
|
|
||||||
"_data": "是否使用自定义的公共事件列表来代替快捷商店列表。\n如果此项开启,则快捷商店列表中将会显示加入的公共事件。"
|
|
||||||
},
|
|
||||||
"checkConsole": {
|
"checkConsole": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "checkbox",
|
"_type": "checkbox",
|
||||||
|
|||||||
@ -37,6 +37,11 @@ editor_blockly = function () {
|
|||||||
{"text": "防御+4", "effect": "status:def+=4"},
|
{"text": "防御+4", "effect": "status:def+=4"},
|
||||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||||
]
|
]
|
||||||
|
},{
|
||||||
|
"id": "keyShop1",
|
||||||
|
"textInList": "回收钥匙商店",
|
||||||
|
"commonEvent": "回收钥匙商店",
|
||||||
|
"args": ""
|
||||||
}],'shop'),
|
}],'shop'),
|
||||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||||
@ -123,7 +128,6 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
|
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
|
||||||
MotaActionBlocks['trigger_s'].xmlText(),
|
MotaActionBlocks['trigger_s'].xmlText(),
|
||||||
MotaActionBlocks['insert_1_s'].xmlText(),
|
MotaActionBlocks['insert_1_s'].xmlText(),
|
||||||
MotaActionBlocks['addToList_s'].xmlText(),
|
|
||||||
MotaActionBlocks['insert_2_s'].xmlText(),
|
MotaActionBlocks['insert_2_s'].xmlText(),
|
||||||
MotaActionBlocks['move_s'].xmlText(),
|
MotaActionBlocks['move_s'].xmlText(),
|
||||||
MotaActionBlocks['jump_s'].xmlText(),
|
MotaActionBlocks['jump_s'].xmlText(),
|
||||||
@ -584,6 +588,7 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
'showTextImage_s': 'EvalString_0',
|
'showTextImage_s': 'EvalString_0',
|
||||||
'function_s': 'RawEvalString_0',
|
'function_s': 'RawEvalString_0',
|
||||||
'shopsub': 'EvalString_3',
|
'shopsub': 'EvalString_3',
|
||||||
|
'unknow_s': 'RawEvalString_0',
|
||||||
}
|
}
|
||||||
var f = b ? textStringDict[b.type] : null;
|
var f = b ? textStringDict[b.type] : null;
|
||||||
if (f) {
|
if (f) {
|
||||||
|
|||||||
@ -249,6 +249,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"name": "贪婪之神",
|
"name": "贪婪之神",
|
||||||
"icon": "blueShop",
|
"icon": "blueShop",
|
||||||
"textInList": "1F金币商店",
|
"textInList": "1F金币商店",
|
||||||
|
"commonTimes": false,
|
||||||
|
"mustEnable": false,
|
||||||
"use": "money",
|
"use": "money",
|
||||||
"need": "20+10*times*(times+1)",
|
"need": "20+10*times*(times+1)",
|
||||||
"text": "勇敢的武士啊,给我${need}金币就可以:",
|
"text": "勇敢的武士啊,给我${need}金币就可以:",
|
||||||
@ -276,6 +278,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"name": "经验之神",
|
"name": "经验之神",
|
||||||
"icon": "pinkShop",
|
"icon": "pinkShop",
|
||||||
"textInList": "1F经验商店",
|
"textInList": "1F经验商店",
|
||||||
|
"commonTimes": false,
|
||||||
|
"mustEnable": false,
|
||||||
"use": "experience",
|
"use": "experience",
|
||||||
"need": "-1",
|
"need": "-1",
|
||||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
"text": "勇敢的武士啊,给我若干经验就可以:",
|
||||||
@ -296,6 +300,13 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"effect": "status:def+=5"
|
"effect": "status:def+=5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "keyShop1",
|
||||||
|
"textInList": "1F回收钥匙商店",
|
||||||
|
"mustEnable": false,
|
||||||
|
"commonEvent": "回收钥匙商店",
|
||||||
|
"args": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"levelUp": [
|
"levelUp": [
|
||||||
|
|||||||
@ -241,18 +241,15 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
"回收钥匙商店": [
|
"回收钥匙商店": [
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "comment",
|
||||||
"text": "公共事件:回收钥匙商店"
|
"text": "此事件在全局商店中被引用了(全局商店keyShop1)"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "addToList"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "comment",
|
||||||
"text": "使用上述事件并在全塔属性打开quickCommonEvent开关"
|
"text": "解除引用前勿删除此事件"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "comment",
|
||||||
"text": "就可以在快捷列表(V键)中使用本公共事件"
|
"text": "玩家在快捷列表(V键)中可以使用本公共事件"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "while",
|
"type": "while",
|
||||||
@ -300,7 +297,27 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
255,
|
255,
|
||||||
1
|
1
|
||||||
],
|
],
|
||||||
"action": []
|
"action": [
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "item:blueKey >= 1",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "item:blueKey",
|
||||||
|
"value": "-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "addValue",
|
||||||
|
"name": "status:money",
|
||||||
|
"value": "50"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"false": [
|
||||||
|
"\t[商人,woman]你没有蓝钥匙!"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "离开",
|
"text": "离开",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user