From 92ae19f2140e595c3c0325984370e85feeee9f4e Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 31 Oct 2020 14:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=B0=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E4=BC=A0=E9=80=81=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 6 ++---- _server/editor_mappanel.js | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 24cad596..4950fb52 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -361,10 +361,8 @@ editor.prototype.changeFloor = function (floorId, callback) { var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0; editor.setViewport(x, y); editor.uifunctions.unhighlightSaveFloorButton(); - - editor.config.set('editorLastFloorId', floorId, function() { - if (callback) callback(); - }); + editor.config.set('editorLastFloorId', floorId); + if (callback) callback(); } /////////// 游戏绘图相关 /////////// diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index 3a4fd25f..e1c1474b 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -464,6 +464,11 @@ editor_mappanel_wrapper = function (editor) { parent.appendChild(extraEvent); editor.dom.extraEvent.style.display = 'block'; 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') { parent.removeChild(extraEvent); parent.insertBefore(extraEvent, parent.firstChild); @@ -514,6 +519,7 @@ editor_mappanel_wrapper = function (editor) { var thisevent = editor.map[editor.pos.y][editor.pos.x]; return editor.uifunctions._extraEvent_bindStartPoint(thisevent) + || editor.uifunctions._extraEvent_changeFloor() || editor.uifunctions._extraEvent_bindStair(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; + } + /** * 绑定该楼梯的楼传事件 */