Merge pull request #160 from zhaouv/v2.x

V2 x
This commit is contained in:
Zhang Chen 2018-06-29 23:00:31 +08:00 committed by GitHub
commit 9295967e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View File

@ -39,24 +39,28 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"itemEffect": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_data": "cls为items的即捡即用类物品的效果如需设置可以先将其设置为空字符串\"\",然后双击进行编辑。"
},
"itemEffectTip": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_data": "cls为items的即捡即用类物品在获得时左上角额外显示的文字如需设置可以先将其设置为空字符串\"\",然后双击进行编辑。"
},
"useItemEffect": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_data": "cls为tools或contants时的使用物品效果如需设置可以先将其设置为空字符串\"\",然后双击进行编辑。"
},
"canUseItemEffect": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_data": "cls为tools或contants时对当前能否使用该物品的判断如需设置可以先将其设置为空字符串\"\",然后双击进行编辑。"
}

View File

@ -413,6 +413,18 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
editor_blockly.id = '';
return;
}
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;
}
}
var setvalue = function (value) {
var thisTr = document.getElementById(editor_blockly.id);
editor_blockly.id = '';
@ -422,7 +434,7 @@ document.getElementById('blocklyDiv').onmousewheel = function(e){
input.onchange();
}
if (codeAreaHL.getValue() === '') {
setvalue('null');
eventType==='shop'?setvalue('[]'):setvalue('null');
return;
}
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);

View File

@ -120,7 +120,7 @@ editor_mode = function (editor) {
}
input.ondblclick = function () {
if (cobj._type === 'event') editor_blockly.import(guid, {type: cobj._event});
if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint});
if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint, string: cobj._string});
}
});

View File

@ -72,7 +72,7 @@ editor_multi = function () {
editor_multi.lintAutocomplete = false;
if (args.lint === true) editor_multi.lintAutocomplete = true;
if (field.indexOf('Effect') !== -1) editor_multi.lintAutocomplete = true;
if (input.value.slice(0, 1) === '"') {
if (input.value.slice(0, 1) === '"' || args.string) {
editor_multi.isString = true;
codeEditor.setValue(JSON.parse(input.value) || '');
} else {