From 9ddefed070396feeb532f4427ca97985aaab7360 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Fri, 29 Jun 2018 23:11:08 +0800 Subject: [PATCH] hide point_m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 隐藏入口方块中的加点 入口方块类型错误时同步的报错 --- _server/editor_blockly.js | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index e58ee4e0..5ccd9b02 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -18,17 +18,17 @@ editor_blockly = function () { {"type": "hide", "time": 500}, ],'event'), MotaActionBlocks['changeFloor_m'].xmlText(), - MotaActionFunctions.actionParser.parse({"type": "choices", "choices": [ - {"text": "攻击+\${point}", "action": [ - {"type": "setValue", "name": "status:atk", "value": "status:atk+\${point}"}, - ]}, - {"text": "防御+\${2*point}", "action": [ - {"type": "setValue", "name": "status:def", "value": "status:def+\${2*point}"}, - ]}, - {"text": "生命+\${200*point}", "action": [ - {"type": "setValue", "name": "status:hp", "value": "status:hp+\${200*point}"}, - ]}, - ]},'point'), + //MotaActionFunctions.actionParser.parse({"type": "choices", "choices": [ + // {"text": "攻击+\${point}", "action": [ + // {"type": "setValue", "name": "status:atk", "value": "status:atk+\${point}"}, + // ]}, + // {"text": "防御+\${2*point}", "action": [ + // {"type": "setValue", "name": "status:def", "value": "status:def+\${2*point}"}, + // ]}, + // {"text": "生命+\${200*point}", "action": [ + // {"type": "setValue", "name": "status:hp", "value": "status:hp+\${200*point}"}, + // ]}, + //]},'point'), MotaActionFunctions.actionParser.parse([{ "id": "moneyShop1", "name": "贪婪之神", @@ -269,6 +269,18 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){ } } } + if(editor_blockly.workspace.topBlocks_.length>=2){ + codeAreaHL.setValue('入口方块只能有一个'); + return; + } + var eventType = document.getElementById('entryType').value; + if(editor_blockly.workspace.topBlocks_.length==1){ + var blockType = editor_blockly.workspace.topBlocks_[0].type; + if(blockType!==eventType+'_m'){ + codeAreaHL.setValue('入口方块类型错误'); + return; + } + } try { var code = Blockly.JavaScript.workspaceToCode(workspace); codeAreaHL.setValue(code);