不打印调试信息;修改事件的trigger

This commit is contained in:
YouWei Zhao 2018-03-14 00:18:19 +08:00
parent 2c7162467f
commit b86d734655
4 changed files with 25 additions and 25 deletions

View File

@ -5,22 +5,22 @@ grammar MotaAction;
//事件 事件编辑器入口之一 //事件 事件编辑器入口之一
event_m event_m
: '事件' BGNL? Newline '启用' Bool '通行状态' B_List '显伤' Bool BGNL? Newline action+ BEND : '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_List '显伤' Bool BGNL? Newline action+ BEND
; ;
/* event_m /* event_m
tooltip : 编辑魔塔的事件 tooltip : 编辑魔塔的事件
helpUrl : https://ckcz123.github.io/mota-js/#/event helpUrl : https://ckcz123.github.io/mota-js/#/event
default : [null,[['不改变','null'],['不可通行','true'],['可以通行','false']],null] default : [false,null,[['不改变','null'],['不可通行','true'],['可以通行','false']],null]
B_List_0=eval(B_List_0); B_List_0=eval(B_List_0);
var code = { var code = {
'trigger': 'action', 'trigger': Bool_0?'action':null,
'enable': Bool_0, 'enable': Bool_1,
'noPass': B_List_0, 'noPass': B_List_0,
'displayDamage': Bool_1, 'displayDamage': Bool_2,
'data': 'data_asdfefw' 'data': 'data_asdfefw'
} }
if (Bool_0 && (B_List_0===null) && Bool_1) code = 'data_asdfefw'; if (!Bool_0 && Bool_1 && (B_List_0===null) && Bool_2) code = 'data_asdfefw';
code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n'); code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n');
return code; return code;
*/ */
@ -317,7 +317,7 @@ show_s
/* show_s /* show_s
tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点 tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=show-%e5%b0%86%e4%b8%80%e4%b8%aa%e7%a6%81%e7%94%a8%e4%ba%8b%e4%bb%b6%e5%90%af%e7%94%a8 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=show-%e5%b0%86%e4%b8%80%e4%b8%aa%e7%a6%81%e7%94%a8%e4%ba%8b%e4%bb%b6%e5%90%af%e7%94%a8
default : [0,0,"",500] default : ["0","0","",500]
colour : this.eventColor colour : this.eventColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/; var pattern = /^([+-]?\d+)(,[+-]?\d+)*$/;
@ -1069,7 +1069,7 @@ ActionParser.prototype.parse = function (obj,type) {
if(typeof(obj)===typeof('')) obj={'data':[obj]}; if(typeof(obj)===typeof('')) obj={'data':[obj]};
if(obj instanceof Array) obj={'data':obj}; if(obj instanceof Array) obj={'data':obj};
return MotaActionBlocks['event_m'].xmlText([ return MotaActionBlocks['event_m'].xmlText([
obj.enable,obj.noPass,obj.displayDamage,this.parseList(obj.data) obj.trigger==='action',obj.enable,obj.noPass,obj.displayDamage,this.parseList(obj.data)
]); ]);
case 'changeFloor': case 'changeFloor':

View File

@ -196,7 +196,7 @@ initscript=String.raw`
var doubleClickCheck=[[0,'abc']]; var doubleClickCheck=[[0,'abc']];
function omitedcheckUpdateFunction(event) { function omitedcheckUpdateFunction(event) {
console.log(event); //console.log(event);
if(event.type==='ui'){ if(event.type==='ui'){
var newClick = [new Date().getTime(),event.blockId]; var newClick = [new Date().getTime(),event.blockId];
var lastClick = doubleClickCheck.shift(); var lastClick = doubleClickCheck.shift();
@ -369,7 +369,7 @@ editor_blockly.confirm = function (){
editor_blockly.doubleClickBlock = function (blockId){ editor_blockly.doubleClickBlock = function (blockId){
var b=editor_blockly.workspace.getBlockById(blockId); var b=editor_blockly.workspace.getBlockById(blockId);
console.log(b); //console.log(b);
var textStringDict = { var textStringDict = {
'text_0_s':'EvalString_0', 'text_0_s':'EvalString_0',
'text_1_s':'EvalString_2', 'text_1_s':'EvalString_2',

View File

@ -477,8 +477,8 @@ editor_file = function(editor, callback){
} }
var saveSetting = function(file,actionList,callback) { var saveSetting = function(file,actionList,callback) {
console.log(file); //console.log(file);
console.log(actionList); //console.log(actionList);
actionList.forEach(function (value) { actionList.forEach(function (value) {
if (value[0]!='change' && file!='icons' && file!='maps') {printe('目前只支持change');throw('目前只支持change')}; if (value[0]!='change' && file!='icons' && file!='maps') {printe('目前只支持change');throw('目前只支持change')};
}); });

View File

@ -174,27 +174,27 @@ editor_mode.prototype.doActionList = function(mode,actionList){
switch (mode) { switch (mode) {
case 'loc': case 'loc':
editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
break; break;
case 'emenyitem': case 'emenyitem':
if (editor_mode.info.images=='enemys'){ if (editor_mode.info.images=='enemys'){
editor.file.editEnemy(editor_mode.info.id,actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editEnemy(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
} else if (editor_mode.info.images=='items'){ } else if (editor_mode.info.images=='items'){
editor.file.editItem(editor_mode.info.id,actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editItem(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
} }
break; break;
case 'floor': case 'floor':
editor.file.editFloor(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editFloor(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
break; break;
case 'tower': case 'tower':
editor.file.editTower(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editTower(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
break; break;
case 'functions': case 'functions':
editor.file.editFunctions(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editFunctions(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
break; break;
default: default:
break; break;
@ -229,7 +229,7 @@ editor_mode.prototype.loc = function(callback){
document.getElementById('pos_a6771a78_a099_417c_828f_0a24851ebfce').innerText=editor_mode.pos.x+','+editor_mode.pos.y; document.getElementById('pos_a6771a78_a099_417c_828f_0a24851ebfce').innerText=editor_mode.pos.x+','+editor_mode.pos.y;
var objs=[]; var objs=[];
editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,[],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,[],function(objs_){objs=objs_;/*console.log(objs_)*/});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo=editor_mode.objToTable(objs[0],objs[1]); var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
document.getElementById('table_3d846fc4_7644_44d1_aa04_433d266a73df').innerHTML=tableinfo.HTML; document.getElementById('table_3d846fc4_7644_44d1_aa04_433d266a73df').innerHTML=tableinfo.HTML;
@ -253,9 +253,9 @@ editor_mode.prototype.emenyitem = function(callback){
var objs=[]; var objs=[];
if (editor_mode.info.images=='enemys'){ if (editor_mode.info.images=='enemys'){
editor.file.editEnemy(editor_mode.info.id,[],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editEnemy(editor_mode.info.id,[],function(objs_){objs=objs_;/*console.log(objs_)*/});
} else if (editor_mode.info.images=='items'){ } else if (editor_mode.info.images=='items'){
editor.file.editItem(editor_mode.info.id,[],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editItem(editor_mode.info.id,[],function(objs_){objs=objs_;/*console.log(objs_)*/});
} else { } else {
document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML=''; document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML='';
return; return;
@ -270,7 +270,7 @@ editor_mode.prototype.emenyitem = function(callback){
editor_mode.prototype.floor = function(callback){ editor_mode.prototype.floor = function(callback){
var objs=[]; var objs=[];
editor.file.editFloor([],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editFloor([],function(objs_){objs=objs_;/*console.log(objs_)*/});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo=editor_mode.objToTable(objs[0],objs[1]); var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
document.getElementById('table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74').innerHTML=tableinfo.HTML; document.getElementById('table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74').innerHTML=tableinfo.HTML;
@ -280,7 +280,7 @@ editor_mode.prototype.floor = function(callback){
editor_mode.prototype.tower = function(callback){ editor_mode.prototype.tower = function(callback){
var objs=[]; var objs=[];
editor.file.editTower([],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editTower([],function(objs_){objs=objs_;/*console.log(objs_)*/});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo=editor_mode.objToTable(objs[0],objs[1]); var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
document.getElementById('table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5').innerHTML=tableinfo.HTML; document.getElementById('table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5').innerHTML=tableinfo.HTML;
@ -290,7 +290,7 @@ editor_mode.prototype.tower = function(callback){
editor_mode.prototype.functions = function(callback){ editor_mode.prototype.functions = function(callback){
var objs=[]; var objs=[];
editor.file.editFunctions([],function(objs_){objs=objs_;console.log(objs_)}); editor.file.editFunctions([],function(objs_){objs=objs_;/*console.log(objs_)*/});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo=editor_mode.objToTable(objs[0],objs[1]); var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
document.getElementById('table_e260a2be_5690_476a_b04e_dacddede78b3').innerHTML=tableinfo.HTML; document.getElementById('table_e260a2be_5690_476a_b04e_dacddede78b3').innerHTML=tableinfo.HTML;
@ -345,7 +345,7 @@ editor_mode.prototype.listen = function(callback){
editor.file.saveFloorFileAs(saveAsName.value,function(err){ editor.file.saveFloorFileAs(saveAsName.value,function(err){
if(err){printe(err);throw(err)} if(err){printe(err);throw(err)}
core.floorIds.push(saveAsName.value); core.floorIds.push(saveAsName.value);
editor.file.editTower([['change',"['main']['floorIds']",core.floorIds]],function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printe('另存为成功,请F5刷新编辑器生效');}); editor.file.editTower([['change',"['main']['floorIds']",core.floorIds]],function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printe('另存为成功,请F5刷新编辑器生效');});
}); });
} }