全局商店重构
This commit is contained in:
parent
7e156e81c9
commit
9db325c931
@ -103,7 +103,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
shopcommonevent
|
shopcommonevent
|
||||||
: '公共事件版商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' JsonEvalString?
|
: '公共事件版商店 id' IdString '快捷名称' EvalString '未开启不显示' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' JsonEvalString?
|
||||||
|
|
||||||
/* shopcommonevent
|
/* shopcommonevent
|
||||||
tooltip : 全局商店, 执行一个公共事件
|
tooltip : 全局商店, 执行一个公共事件
|
||||||
@ -125,55 +125,61 @@ 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? BGNL? Newline '快捷名称' EvalString '共用次数' Bool '未开启不显示' Bool BGNL? Newline '消耗' EvalString BGNL? Newline '(访问次数:临时变量A;当前消耗:临时变量B)' BGNL? Newline shopChoices+ BEND
|
||||||
|
|
||||||
|
|
||||||
/* shopsub
|
/* shopsub
|
||||||
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
|
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
|
||||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
||||||
default : ["shop1","贪婪之神","blueShop","1F金币商店",false,false,null,"20+10*times*(times+1)","勇敢的武士啊, 给我${need}金币就可以:"]
|
default : ["shop1","贪婪之神","blueShop","勇敢的武士啊, 给我${temp:B}金币就可以:","1F金币商店",false,false,"20+10*temp:A*(temp:A+1)"]
|
||||||
|
var title='';
|
||||||
|
if (EvalString_0==''){
|
||||||
|
if (IdString_1=='') title='';
|
||||||
|
else title='\t['+IdString_1+']';
|
||||||
|
} else {
|
||||||
|
if (IdString_1=='')title='\t['+EvalString_0+']';
|
||||||
|
else title='\t['+EvalString_0+','+IdString_1+']';
|
||||||
|
}
|
||||||
var code = {
|
var code = {
|
||||||
'id': IdString_0,
|
'id': IdString_0,
|
||||||
'name': EvalString_0,
|
'text': title+EvalString_1,
|
||||||
'icon': IdString_1,
|
'textInList': EvalString_2,
|
||||||
'textInList': EvalString_1,
|
|
||||||
'commonTimes': Bool_0,
|
'commonTimes': Bool_0,
|
||||||
'mustEnable': Bool_1,
|
'mustEnable': Bool_1,
|
||||||
'use': ShopUse_List_0,
|
'need': EvalString_3,
|
||||||
'need': EvalString_2,
|
|
||||||
'text': EvalString_3,
|
|
||||||
'choices': 'choices_asdfefw'
|
'choices': 'choices_asdfefw'
|
||||||
}
|
}
|
||||||
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';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
shopChoices
|
shopChoices
|
||||||
: '商店选项' EvalString '消耗' EvalString? BGNL? Newline shopEffect+
|
: '商店选项' EvalString '使用条件' EvalString BGNL? Newline '图标' IdString? '颜色' ColorString? Colour '出现条件' EvalString? BGNL? Newline shopEffect+
|
||||||
|
|
||||||
|
|
||||||
/* shopChoices
|
/* shopChoices
|
||||||
tooltip : 商店选项,商店消耗是-1时,这里的消耗对应各自选项的消耗,商店消耗不是-1时这里的消耗不填
|
tooltip : 商店选项,商店消耗是-1时,这里的消耗对应各自选项的消耗,商店消耗不是-1时这里的消耗不填
|
||||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
|
||||||
default : ["攻击+1",""]
|
default : ["攻击+1","status:money>=temp:B","","","rgba(255,255,255,1)",""]
|
||||||
colour : this.subColor
|
colour : this.subColor
|
||||||
EvalString_1 = EvalString_1 && (', "need": "'+EvalString_1+'"');
|
ColorString_0 = ColorString_0 ? (', "color": ['+ColorString_0+']') : '';
|
||||||
var code = '{"text": "'+EvalString_0+'"'+EvalString_1+', "effect": "'+shopEffect_0.slice(2,-1)+'"},\n';
|
EvalString_2 = EvalString_2 && (', "condition": "'+EvalString_1+'"')
|
||||||
|
IdString_0 = IdString_0? (', "icon": "'+IdString_0+'"'):'';
|
||||||
|
var code = '{"text": "'+EvalString_0+'", "need": "'+EvalString_1+'"'+IdString_0+ColorString_0+EvalString_2+', "effect": [\n'+shopEffect_0+']},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
shopEffect
|
shopEffect
|
||||||
: idString_e '+=' expression
|
: idString_e AssignOperator_List expression
|
||||||
|
|
||||||
|
|
||||||
/* shopEffect
|
/* shopEffect
|
||||||
colour : this.subColor
|
colour : this.subColor
|
||||||
var code = idString_e_0+'+='+expression_0+';'
|
return '{"name": "'+idString_e_0+'", "operator": "'+AssignOperator_List_0+'", "value": "'+expression_0+'"},\n';
|
||||||
return code;
|
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
shopitem
|
shopitem
|
||||||
: '道具商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? Newline shopItemChoices+ BEND
|
: '道具商店 id' IdString '快捷名称' EvalString '未开启不显示' Bool BGNL? Newline shopItemChoices+ BEND
|
||||||
|
|
||||||
|
|
||||||
/* shopitem
|
/* shopitem
|
||||||
@ -187,7 +193,7 @@ var code = {
|
|||||||
'mustEnable': Bool_0,
|
'mustEnable': Bool_0,
|
||||||
'choices': 'choices_aqwedsa'
|
'choices': 'choices_aqwedsa'
|
||||||
}
|
}
|
||||||
code=JSON.stringify(code,null,2).split('"choices_aqwedsa"').join('[\n'+shopItemChoices_0+']\n')+',\n';
|
code=JSON.stringify(code,null,2).split('"choices_aqwedsa"').join('[\n'+shopItemChoices_0+']')+',\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -2911,21 +2917,19 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
var text_choices = null;
|
var text_choices = null;
|
||||||
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
|
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
|
||||||
var text_effect = null;
|
var text_effect = null;
|
||||||
var effectList = choice.effect.split(';');
|
choice.effect = choice.effect || [];
|
||||||
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
|
for (var jj=choice.effect.length-1,effect;effect=choice.effect[jj];jj--) {
|
||||||
if(effect.split('+=').length!==2){
|
text_effect = MotaActionBlocks['shopEffect'].xmlText([
|
||||||
throw new Error('一个商店效果中必须包含恰好一个"+="');
|
parser.tryToUseEvFlag_e('idString_e', [effect.name]), effect.operator || '=',
|
||||||
}
|
MotaActionBlocks['evalString_e'].xmlText([effect.value]), text_effect
|
||||||
text_effect=MotaActionBlocks['shopEffect'].xmlText([
|
]);
|
||||||
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
|
|
||||||
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
|
|
||||||
text_effect]);
|
|
||||||
}
|
}
|
||||||
text_choices=MotaActionBlocks['shopChoices'].xmlText([
|
text_choices=MotaActionBlocks['shopChoices'].xmlText([
|
||||||
choice.text,choice.need||'',text_effect,text_choices]);
|
choice.text,choice.need||'',choice.icon,choice.color,'rgba('+choice.color+')',choice.condition,text_effect,text_choices]);
|
||||||
}
|
}
|
||||||
|
var info = parser.getTitleAndPosition(obj.text || '');
|
||||||
return MotaActionBlocks['shopsub'].xmlText([
|
return MotaActionBlocks['shopsub'].xmlText([
|
||||||
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[0],info[1],info[3],obj.textInList,obj.commonTimes,obj.mustEnable,obj.need,text_choices,next
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
var buildcommentevent = function(obj,parser,next){
|
var buildcommentevent = function(obj,parser,next){
|
||||||
|
|||||||
@ -39,15 +39,18 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['changeFloor_m'].xmlText(),
|
MotaActionBlocks['changeFloor_m'].xmlText(),
|
||||||
MotaActionFunctions.actionParser.parse([{
|
MotaActionFunctions.actionParser.parse([{
|
||||||
"id": "moneyShop1",
|
"id": "moneyShop1",
|
||||||
"name": "贪婪之神",
|
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我\${temp:B}金币就可以:",
|
||||||
"icon": "blueShop",
|
|
||||||
"textInList": "1F金币商店",
|
"textInList": "1F金币商店",
|
||||||
"use": "money",
|
"need": "20+10*temp:A*(temp:A+1)",
|
||||||
"need": "20+10*times*(times+1)",
|
|
||||||
"text": "勇敢的武士啊,给我\\\${need}金币就可以:",
|
|
||||||
"choices": [
|
"choices": [
|
||||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
{"text": "生命+800", "need": "status:money>=temp:B", "effect": [
|
||||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
{"name": "status:money", "operator": "-=", "value": "temp:B"},
|
||||||
|
{"name": "status:hp", "operator": "+=", "value": "800"},
|
||||||
|
]},
|
||||||
|
{"text": "攻击+4", "need": "status:money>=temp:B", "effect": [
|
||||||
|
{"name": "status:money", "operator": "-=", "value": "temp:B"},
|
||||||
|
{"name": "status:atk", "operator": "+=", "value": "4"},
|
||||||
|
]},
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
"id": "itemShop",
|
"id": "itemShop",
|
||||||
@ -727,7 +730,7 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
'choices_s': 'EvalString_0',
|
'choices_s': 'EvalString_0',
|
||||||
'showTextImage_s': 'EvalString_0',
|
'showTextImage_s': 'EvalString_0',
|
||||||
'function_s': 'RawEvalString_0',
|
'function_s': 'RawEvalString_0',
|
||||||
'shopsub': 'EvalString_3',
|
'shopsub': 'EvalString_1',
|
||||||
'confirm_s': 'EvalString_0',
|
'confirm_s': 'EvalString_0',
|
||||||
'drawTextContent_s': 'EvalString_0',
|
'drawTextContent_s': 'EvalString_0',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -300,36 +300,32 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"shops": [
|
"shops": [
|
||||||
{
|
{
|
||||||
"id": "moneyShop1",
|
"id": "moneyShop1",
|
||||||
"name": "贪婪之神",
|
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${temp:B}金币就可以:",
|
||||||
"icon": "blueShop",
|
|
||||||
"textInList": "1F金币商店",
|
"textInList": "1F金币商店",
|
||||||
"commonTimes": false,
|
"commonTimes": false,
|
||||||
"mustEnable": false,
|
"mustEnable": false,
|
||||||
"use": "money",
|
"need": "20+10*temp:A*(temp:A+1)",
|
||||||
"need": "20+10*times*(times+1)",
|
|
||||||
"text": "勇敢的武士啊,给我${need}金币就可以:",
|
|
||||||
"choices": [
|
"choices": [
|
||||||
{
|
{
|
||||||
"text": "生命+800",
|
"text": "生命+800",
|
||||||
"effect": "status:hp+=800"
|
"need": "status:money>=temp:B",
|
||||||
}
|
"effect": [
|
||||||
]
|
{
|
||||||
},
|
"name": "status:money",
|
||||||
{
|
"operator": "-=",
|
||||||
"id": "expShop1",
|
"value": "temp:B"
|
||||||
"name": "经验之神",
|
},
|
||||||
"icon": "pinkShop",
|
{
|
||||||
"textInList": "1F经验商店",
|
"name": "status:hp",
|
||||||
"commonTimes": false,
|
"operator": "+=",
|
||||||
"mustEnable": false,
|
"value": "800"
|
||||||
"use": "exp",
|
},
|
||||||
"need": "-1",
|
{
|
||||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
"name": "flag:xxx",
|
||||||
"choices": [
|
"operator": "=",
|
||||||
{
|
"value": "temp:B"
|
||||||
"text": "等级+1",
|
}
|
||||||
"need": "100",
|
]
|
||||||
"effect": "status:hp+=1000"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -342,7 +338,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
{
|
{
|
||||||
"id": "yellowKey",
|
"id": "yellowKey",
|
||||||
"number": 10,
|
"number": 10,
|
||||||
"money": 10
|
"money": "10"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user