hide point_m

隐藏入口方块中的加点
入口方块类型错误时同步的报错
This commit is contained in:
YouWei Zhao 2018-06-29 23:11:08 +08:00
parent a9d92e7996
commit 9ddefed070

View File

@ -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);