From 7b2c7c3509444f1c0cea36ca0caa2d8dd573d63b Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Fri, 23 Feb 2018 16:28:49 +0800 Subject: [PATCH] Update editor-blockly-template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 事件模板中添加 检测音乐如果没有开启则系统提示开启 --- _server/editor_blockly.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 9ece3a08..7d6da9ea 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -112,6 +112,13 @@ initscript=String.raw` MotaActionBlocks['evalString_e'].xmlText(), ], 'template':[ + '', + MotaActionFunctions.actionParser.parseList({"type": "if", "condition": "!core.musicStatus.bgmStatus", + "true": [ + "\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳" + ], + "false": [] + }), '', MotaActionFunctions.actionParser.parse({ "trigger": "action", @@ -363,19 +370,19 @@ editor_blockly.doubleClickBlock = function (blockId){ var b=editor_blockly.workspace.getBlockById(blockId); console.log(b); var textStringDict = { - 'text_0_s':'EvalString_0', - 'text_1_s':'EvalString_2', - 'choices_s':'EvalString_0', - 'function_s':'RawEvalString_0', + 'text_0_s':'EvalString_0', + 'text_1_s':'EvalString_2', + 'choices_s':'EvalString_0', + 'function_s':'RawEvalString_0', } - var f=textStringDict[b.type]; + var f=b?textStringDict[b.type]:null; if(f){ - var value = b.getFieldValue(f); - //多行编辑 - editor_blockly.multiLineEdit(value,b,f,function(newvalue,b,f){ - if(textStringDict[b.type]!=='RawEvalString_0'){} - b.setFieldValue(newvalue.split('\n').join('\\n'),f); - }); + var value = b.getFieldValue(f); + //多行编辑 + editor_blockly.multiLineEdit(value,b,f,function(newvalue,b,f){ + if(textStringDict[b.type]!=='RawEvalString_0'){} + b.setFieldValue(newvalue.split('\n').join('\\n'),f); + }); } }