type:switch

This commit is contained in:
tocque 2018-11-09 23:53:14 +09:00
parent 3b5e7a0e30
commit e3f03d8646
2 changed files with 4 additions and 6 deletions

View File

@ -1243,7 +1243,7 @@ switch_s
/* switch_s
tooltip : switch: 多重条件分歧
helpUrl : https://ckcz123.github.io/mota-js/#/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
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=switch%EF%BC%9A%E5%A4%9A%E9%87%8D%E6%9D%A1%E4%BB%B6%E5%88%86%E6%AD%A7
default : ["判别值"]
colour : this.eventColor
var code = ['{"type": "switch", "condition": "',expression_0,'", "caseList": [\n',
@ -1258,7 +1258,7 @@ switchCase_s
/* switchCase_s
tooltip : 选项的选择
helpUrl : https://ckcz123.github.io/mota-js/#/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
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=switch%EF%BC%9A%E5%A4%9A%E9%87%8D%E6%9D%A1%E4%BB%B6%E5%88%86%E6%AD%A7
colour : this.subColor
var code = '{"case": "'+expression_0+'", "action": [\n'+action_0+']},\n';
return code;
@ -1270,7 +1270,7 @@ choices_s
/* choices_s
tooltip : choices: 给用户提供选项
helpUrl : https://ckcz123.github.io/mota-js/#/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
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=switch%EF%BC%9A%E5%A4%9A%E9%87%8D%E6%9D%A1%E4%BB%B6%E5%88%86%E6%AD%A7
default : ["","流浪者","woman"]
var title='';
if (EvalString_1==''){

View File

@ -909,15 +909,13 @@ events.prototype.doAction = function() {
break;
case "switch": // 条件选择
var key = core.calValue(data.condition)
console.log(key);
for (var i = 0; i < data.caseList.length; i++) {
console.log(core.calValue(data.caseList[i].case));
if (core.calValue(data.caseList[i].case) == key || core.calValue(data.caseList[i].case) == "default") {
core.events.insertAction(data.caseList[i].action);
this.doAction();
break;
}
}
this.doAction();
break;
case "choices": // 提供选项
if (core.status.replay.replaying) {