changeFloor symmetry point

This commit is contained in:
oc 2019-05-26 12:01:39 +08:00
parent 22f8927708
commit a57771d1bf
4 changed files with 31 additions and 9 deletions

View File

@ -228,7 +228,7 @@ default : [null,"MT1",null,0,0,null,500,null]
var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
if (Stair_List_0==='now')loc = '';
if (Stair_List_0===':now') loc = '';
else if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = (Int_0!=='') ?(', "time": '+Int_0):'';
@ -2032,8 +2032,8 @@ Floor_List
/*Floor_List ['floorId',':before',':next']*/;
Stair_List
: '坐标'|'上楼梯'|'下楼梯'|'保持不变'
/*Stair_List ['loc','upFloor','downFloor','now']*/;
: '坐标'|'上楼梯'|'下楼梯'|'保持不变'|'中心对称点'|'x对称点'|'y对称点'
/*Stair_List ['loc','upFloor','downFloor',':now',':symmetry',':symmetry_x',':symmetry_y']*/;
SetTextPosition_List
: '不改变'|'距离顶部'|'居中'|'距离底部'
@ -2220,7 +2220,7 @@ ActionParser.prototype.parse = function (obj,type) {
if(!obj)obj={};
if(!this.isset(obj.loc)) {
obj.loc=[0,0];
if (!this.isset(obj.stair)) obj.stair='now';
if (!this.isset(obj.stair)) obj.stair=':now';
}
if (obj.floorId==':before'||obj.floorId==':next') {
obj.floorType=obj.floorId;

View File

@ -57,7 +57,7 @@ editor_mode = function (editor) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功');
;printf('修改成功' + (data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.name == 'template' ? '\n\n请注意全塔属性的name尚未修改请及时予以设置' : ''));
}
switch (mode) {
case 'loc':

View File

@ -502,6 +502,10 @@ editor.constructor.prototype.listen=function () {
addFloorEvent.style.display='block';
addFloorEvent.children[0].innerHTML='绑定下楼事件';
}
else if (['leftPortal','rightPortal','downPortal','upPortal'].indexOf(thisevent.id)>=0) {
addFloorEvent.style.display='block';
addFloorEvent.children[0].innerHTML='绑定楼传事件';
}
else addFloorEvent.style.display='none';
chooseThis.children[0].innerHTML='选中此点'+'('+editor.pos.x+','+editor.pos.y+')'
@ -524,20 +528,27 @@ editor.constructor.prototype.listen=function () {
editor.hideMidMenu();
e.stopPropagation();
var thisevent = editor.map[editor.pos.y][editor.pos.x];
var loc = editor.pos.x+","+editor.pos.y;
if (thisevent.id=='upFloor') {
editor.currentFloorData.changeFloor[editor.pos.x+","+editor.pos.y] = {"floorId": ":next", "stair": "downFloor"};
editor.currentFloorData.changeFloor[loc] = {"floorId": ":next", "stair": "downFloor"};
}
else if (thisevent.id=='downFloor') {
editor.currentFloorData.changeFloor[editor.pos.x+","+editor.pos.y] = {"floorId": ":before", "stair": "upFloor"};
editor.currentFloorData.changeFloor[loc] = {"floorId": ":before", "stair": "upFloor"};
}
else if (thisevent.id=='leftPortal' || thisevent.id=='rightPortal') {
editor.currentFloorData.changeFloor[loc] = {"floorId": ":next", "stair": ":symmetry_x"}
}
else if (thisevent.id=='upPortal' || thisevent.id=='downPortal') {
editor.currentFloorData.changeFloor[loc] = {"floorId": ":next", "stair": ":symmetry_y"}
}
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('添加楼梯事件成功');
editor.drawPosSelection();
editor_mode.showMode('loc');
printf('添加楼梯事件成功');
});
}

View File

@ -548,8 +548,19 @@ events.prototype._changeFloor_getHeroLoc = function (floorId, stair, heroLoc) {
if (!heroLoc)
heroLoc = core.clone(core.status.hero.loc);
if (stair) {
// --- 对称
if (stair == ':now')
heroLoc = core.clone(core.status.hero.loc);
else if (stair == ':symmetry') {
heroLoc.x = core.bigmap.width - 1 - core.getHeroLoc('x');
heroLoc.y = core.bigmap.height - 1 - core.getHeroLoc('y');
}
else if (stair == ':symmetry_x')
heroLoc.x = core.bigmap.width - 1 - core.getHeroLoc('x');
else if (stair == ':symmetry_y')
heroLoc.y = core.bigmap.height - 1 - core.getHeroLoc('y');
// 检查该层地图的 upFloor & downFloor
if (core.status.maps[floorId][stair]) {
else if (core.status.maps[floorId][stair]) {
heroLoc.x = core.status.maps[floorId][stair][0];
heroLoc.y = core.status.maps[floorId][stair][1];
}