noGlobalAnimate

This commit is contained in:
oc 2018-12-13 23:50:01 +08:00
parent 7be7d3706f
commit e8559f3e2d
4 changed files with 20 additions and 8 deletions

View File

@ -5,22 +5,23 @@ grammar MotaAction;
//事件 事件编辑器入口之一 //事件 事件编辑器入口之一
event_m event_m
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '显伤' Bool BGNL? Newline action+ BEND : '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '动画' Bool '显伤' Bool BGNL? Newline action+ BEND
/* event_m /* event_m
tooltip : 编辑魔塔的事件 tooltip : 编辑魔塔的事件
helpUrl : https://h5mota.com/games/template/docs/#/event helpUrl : https://h5mota.com/games/template/docs/#/event
default : [false,null,null,null] default : [false,null,null,null,null]
B_0_List_0=eval(B_0_List_0); B_0_List_0=eval(B_0_List_0);
var code = { var code = {
'trigger': Bool_0?'action':null, 'trigger': Bool_0?'action':null,
'enable': Bool_1, 'enable': Bool_1,
'noPass': B_0_List_0, 'noPass': B_0_List_0,
'displayDamage': Bool_2, 'animate': Bool_2,
'displayDamage': Bool_3,
'data': 'data_asdfefw' 'data': 'data_asdfefw'
} }
if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2) code = 'data_asdfefw'; if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2 && Bool_3) 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;
*/; */;
@ -1803,7 +1804,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.trigger==='action',obj.enable,obj.noPass,obj.displayDamage,this.parseList(obj.data) obj.trigger==='action',obj.enable,obj.noPass,obj.animate,obj.displayDamage,this.parseList(obj.data)
]); ]);
case 'changeFloor': case 'changeFloor':

View File

@ -261,7 +261,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)", "_range": "thiseval==null||(thiseval instanceof Array)",
"_data": "该图块的不可入方向\n可以在这里定义不能从哪个方向访问该图块,可以达到悬崖之类的效果\n例如 [\"down\", \"right\"] 代表不能从下或右访问此图块\n此值对背景层、事件层、前景层上的图块均有效" "_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块,可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
}, },
"faceIds": { "faceIds": {
"_leaf": true, "_leaf": true,

View File

@ -295,11 +295,18 @@ editor.prototype.drawPosSelection = function () {
} }
editor.prototype.updateMap = function () { editor.prototype.updateMap = function () {
var evs = {};
if (editor.currentFloorData && editor.currentFloorData.events) {
for (var loc in editor.currentFloorData.events) {
if (editor.currentFloorData.events[loc].animate == false)
evs[loc] = {"animate": false};
}
}
var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) { var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) {
return v.map(function (v) { return v.map(function (v) {
return v.idnum || v || 0 return v.idnum || v || 0
}) })
}), {'events': {}, 'changeFloor': {}}, editor.currentFloorId); }), {'events': evs, 'changeFloor': {}}, editor.currentFloorId);
core.status.thisMap.blocks = blocks; core.status.thisMap.blocks = blocks;
main.editor.updateMap(); main.editor.updateMap();

View File

@ -146,9 +146,13 @@ maps.prototype.addEvent = function (block, x, y, event) {
if (!core.isset(block.disable) && core.isset(event.enable)) { if (!core.isset(block.disable) && core.isset(event.enable)) {
block.disable=!event.enable; block.disable=!event.enable;
} }
// 覆盖animate
if (event.animate === false) {
block.event.animate = 1;
}
// 覆盖所有属性 // 覆盖所有属性
for (var key in event) { for (var key in event) {
if (key!="enable" && core.isset(event[key])) { if (key!="enable" && key!="animate" && core.isset(event[key])) {
block.event[key]=core.clone(event[key]); block.event[key]=core.clone(event[key]);
} }
} }