blockly common entry
This commit is contained in:
parent
634c9cdeba
commit
9aa44f51a4
@ -28,6 +28,18 @@ grammar MotaAction;
|
||||
//===============parser===============
|
||||
//===blockly语句===
|
||||
|
||||
common_m
|
||||
: '编辑事件' BGNL? Newline action+ BEND
|
||||
|
||||
|
||||
/* common_m
|
||||
tooltip : 编辑事件
|
||||
helpUrl : /_docs/#/instruction
|
||||
var code = '[\n'+action_0+']\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
|
||||
//事件 事件编辑器入口之一
|
||||
event_m
|
||||
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND
|
||||
|
||||
@ -105,7 +105,7 @@ editor_blockly = function () {
|
||||
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
|
||||
return {'<': '<', '>': '>', '&': '&'}[c];
|
||||
}).replace(/\\(r|f|i|c|d|e|g|z)/g,'\\\\$1')),
|
||||
editor_blockly.entryType
|
||||
editor_blockly.isCommonEntry() ? 'common' : editor_blockly.entryType
|
||||
);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ editor_blockly = function () {
|
||||
var eventType = editor_blockly.entryType;
|
||||
if(editor_blockly.workspace.topBlocks_.length==1){
|
||||
var blockType = editor_blockly.workspace.topBlocks_[0].type;
|
||||
if(blockType!==eventType+'_m'){
|
||||
if(blockType!==eventType+'_m' && !(editor_blockly.isCommonEntry() && blockType == 'common_m')){
|
||||
editor_blockly.setValue('入口方块类型错误');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ editor_blocklyconfig=(function(){
|
||||
"commonEvent": "回收钥匙商店",
|
||||
"args": ""
|
||||
}],'shop'),
|
||||
MotaActionBlocks['common_m'].xmlText(),
|
||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
||||
@ -374,10 +375,15 @@ var workspace = Blockly.inject(blocklyDiv,{
|
||||
trashcan: false,
|
||||
});
|
||||
|
||||
editor_blockly.isCommonEntry = function () {
|
||||
var commonEntries = ['afterBattle', 'afterOpenDoor', 'firstArrive', 'eachArrive', 'commonEvent', 'item'];
|
||||
return commonEntries.indexOf(editor_blockly.entryType) >= 0;
|
||||
}
|
||||
|
||||
editor_blockly.entranceCategoryCallback = function(workspace) {
|
||||
var list=toolboxObj['入口方块']
|
||||
var xmlList = [];
|
||||
var eventType = editor_blockly.entryType+'_m';
|
||||
var eventType = (editor_blockly.isCommonEntry() ? 'common' : editor_blockly.entryType)+'_m';
|
||||
for(var ii=0,blockText;blockText=list[ii];ii++){
|
||||
if(new RegExp('<block type="'+eventType+'">').exec(blockText)){
|
||||
var block = Blockly.Xml.textToDom('<xml>'+blockText+'</xml>').firstChild;
|
||||
@ -452,7 +458,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
var eventType = editor_blockly.entryType;
|
||||
if(editor_blockly.workspace.topBlocks_.length==1){
|
||||
var blockType = editor_blockly.workspace.topBlocks_[0].type;
|
||||
if(blockType!==eventType+'_m'){
|
||||
if(blockType!==eventType+'_m' && !(editor_blockly.isCommonEntry() && blockType == 'common_m')){
|
||||
editor_blockly.setValue('入口方块类型错误');
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user