diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 0951f47d..d4c6092d 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -108,10 +108,10 @@ editor_blockly = function () { ], '事件控制':[ MotaActionBlocks['if_s'].xmlText(), - MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别量", "caseList": [ + MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [ {"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]}, {"action": []}, - {"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行此事件"}]}, + {"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行default事件"}]}, ]}), MotaActionBlocks['while_s'].xmlText(), MotaActionBlocks['break_s'].xmlText(), diff --git a/docs/event.md b/docs/event.md index 3fd250bb..9a94da0d 100644 --- a/docs/event.md +++ b/docs/event.md @@ -1224,11 +1224,11 @@ text为提示文字,可以在这里给输入提示文字。这里同样可以 ] ``` -我们可以在condition中给出一个表达式(能将`status:xxx, item:xxx, flag:xxx`来作为参数),并计算它的值 +我们可以在condition中给出一个表达式(能将`status:xxx`, `item:xxx`, `flag:xxx`来作为参数),并计算它的值 如果某条件中的值与其相等,则将执行其对应的列表事件内容。 -如果没有符合的值,则将执行`"default"`中的列表事件内容。 +如果没有符合的值,则将执行`default`中的列表事件内容。 例如下面这个例子,将检查当前游戏难度并赠送不同属性。 @@ -1257,7 +1257,7 @@ text为提示文字,可以在这里给输入提示文字。这里同样可以 需要额外注意的几点: - 各个条件分支的判断是顺序执行的,因此若多个分支的条件都满足,将只执行最靠前的分支,同理,请不要在`"default"`分支后添加分支,这些分支将不可能被执行。 --`"default"`分支并不是必要的,如果删除,则在没有满足条件的分支时将不执行任何事件。 +- `default`分支并不是必要的,如果删除,则在没有满足条件的分支时将不执行任何事件。 - 即使某个场合不执行事件,对应的action数组也需要存在,不过简单的留空就好。 - switch可以不断进行嵌套,一层套一层;如某条件成立的场合再进行另一个switch判断等。 - switch语句内的内容执行完毕后将接着其后面的语句继续执行。 diff --git a/libs/events.js b/libs/events.js index ea82e767..f808aee2 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1641,8 +1641,8 @@ events.prototype.openShop = function(shopId, needVisited) { var choice = shop.choices[i]; var text = choice.text; if (core.isset(choice.need)) - text += "("+eval(choice.need)+use+")" - choices.push(text); + text += "("+eval(choice.need)+use+")"; + choices.push({"text": text, "color":shop.visited?null:"#999999"}); } choices.push("离开"); core.ui.drawChoices(content, choices); diff --git a/libs/ui.js b/libs/ui.js index 94dd9496..bccea85f 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -797,7 +797,9 @@ ui.prototype.drawQuickShop = function () { core.status.event.id = 'selectShop'; var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {return shopList[shopId].visited || !shopList[shopId].mustEnable}); - var choices = keys.map(function (shopId) {return shopList[shopId].textInList}); + var choices = keys.map(function (shopId) { + return {"text": shopList[shopId].textInList, "color": shopList[shopId].visited?null:"#999999"}; + }); choices.push("返回游戏"); this.drawChoices(null, choices);