跳转到目标传送点

This commit is contained in:
ckcz123 2020-10-31 14:55:25 +08:00
parent 4bdfc276c9
commit 92ae19f214
2 changed files with 27 additions and 4 deletions

View File

@ -361,10 +361,8 @@ editor.prototype.changeFloor = function (floorId, callback) {
var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0; var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0;
editor.setViewport(x, y); editor.setViewport(x, y);
editor.uifunctions.unhighlightSaveFloorButton(); editor.uifunctions.unhighlightSaveFloorButton();
editor.config.set('editorLastFloorId', floorId);
editor.config.set('editorLastFloorId', floorId, function() { if (callback) callback();
if (callback) callback();
});
} }
/////////// 游戏绘图相关 /////////// /////////// 游戏绘图相关 ///////////

View File

@ -464,6 +464,11 @@ editor_mappanel_wrapper = function (editor) {
parent.appendChild(extraEvent); parent.appendChild(extraEvent);
editor.dom.extraEvent.style.display = 'block'; editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定出生点为此点'; editor.dom.extraEvent.children[0].innerHTML = '绑定出生点为此点';
} else if (editor.currentFloorData.changeFloor[editor.pos.x + "," + editor.pos.y]) {
parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '跳转到目标传送点';
} else if (thisevent.id == 'upFloor') { } else if (thisevent.id == 'upFloor') {
parent.removeChild(extraEvent); parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild); parent.insertBefore(extraEvent, parent.firstChild);
@ -514,6 +519,7 @@ editor_mappanel_wrapper = function (editor) {
var thisevent = editor.map[editor.pos.y][editor.pos.x]; var thisevent = editor.map[editor.pos.y][editor.pos.x];
return editor.uifunctions._extraEvent_bindStartPoint(thisevent) return editor.uifunctions._extraEvent_bindStartPoint(thisevent)
|| editor.uifunctions._extraEvent_changeFloor()
|| editor.uifunctions._extraEvent_bindStair(thisevent) || editor.uifunctions._extraEvent_bindStair(thisevent)
|| editor.uifunctions._extraEvent_bindSpecialDoor(thisevent); || editor.uifunctions._extraEvent_bindSpecialDoor(thisevent);
} }
@ -538,6 +544,25 @@ editor_mappanel_wrapper = function (editor) {
}); });
} }
editor.uifunctions._extraEvent_changeFloor = function () {
var changeFloor = editor.currentFloorData.changeFloor[editor.pos.x + "," + editor.pos.y];
if (!changeFloor) return false;
core.status.hero.loc = {x: editor.pos.x, y: editor.pos.y, direction: "up"};
var targetLoc = changeFloor.loc ? {x: changeFloor.loc[0], y: changeFloor.loc[1]} : null;
var info = core.events._changeFloor_getInfo(changeFloor.floorId, changeFloor.stair, targetLoc);
editor_mode.onmode('nextChange');
editor_mode.onmode('floor');
editor.dom.selectFloor.value = info.floorId;
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(info.floorId, function () {
editor.pos.x = info.heroLoc.x;
editor.pos.y = info.heroLoc.y;
editor.setViewport(32 * (editor.pos.x - core.__HALF_SIZE__), 32 * (editor.pos.y - core.__HALF_SIZE__));
editor.drawPosSelection();
});
return true;
}
/** /**
* 绑定该楼梯的楼传事件 * 绑定该楼梯的楼传事件
*/ */