From cebb4a73c075e630d3e4c3701d763a5f727b2749 Mon Sep 17 00:00:00 2001 From: oc Date: Wed, 20 Mar 2019 14:18:05 +0800 Subject: [PATCH] flyTo --- _server/functions.comment.js | 12 ++++----- libs/events.js | 2 +- project/functions.js | 51 ++++++++++++++++++------------------ 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/_server/functions.comment.js b/_server/functions.comment.js index d387de4f..1d295260 100644 --- a/_server/functions.comment.js +++ b/_server/functions.comment.js @@ -42,6 +42,12 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_lint": true, "_data": "切换楼层后" }, + "flyTo": { + "_leaf": true, + "_type": "textarea", + "_lint": true, + "_data": "楼层飞行" + }, "beforeBattle": { "_leaf": true, "_type": "textarea", @@ -147,12 +153,6 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_lint": true, "_data": "读档操作" }, - "flyTo": { - "_leaf": true, - "_type": "textarea", - "_lint": true, - "_data": "楼层飞行" - }, "updateStatusBar": { "_leaf": true, "_type": "textarea", diff --git a/libs/events.js b/libs/events.js index cf447186..22f4de0a 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1593,7 +1593,7 @@ events.prototype.useFly = function (fromUserAction) { } events.prototype.flyTo = function (toId, callback) { - return this.controldata.flyTo(toId, callback); + return this.eventdata.flyTo(toId, callback); } ////// 点击装备栏时的打开操作 ////// diff --git a/project/functions.js b/project/functions.js index ddcf33ef..e323d68c 100644 --- a/project/functions.js +++ b/project/functions.js @@ -172,6 +172,32 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.visitFloor(floorId); } } +}, + "flyTo": function (toId, callback) { + // 楼层传送器的使用,从当前楼层飞往toId + // 如果不能飞行请返回false + + var fromId = core.status.floorId; + + // 检查能否飞行 + if (!core.status.maps[fromId].canFlyTo || !core.status.maps[toId].canFlyTo) { + core.drawTip("无法飞往" + core.status.maps[toId].title + "!"); + return false; + } + + // 获得两个楼层的索引,以决定是上楼梯还是下楼梯 + var fromIndex = core.floorIds.indexOf(fromId), + toIndex = core.floorIds.indexOf(toId); + var stair = fromIndex <= toIndex ? "downFloor" : "upFloor"; + // 地下层:同层传送至上楼梯 + if (fromIndex == toIndex && core.status.maps[fromId].underGround) stair = "upFloor"; + // 记录录像 + core.status.route.push("fly:" + toId); + // 传送 + core.ui.closePanel(); + core.changeFloor(toId, stair, null, null, callback); + + return true; }, "beforeBattle": function (enemyId, x, y) { // 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子) @@ -946,31 +972,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 切换到对应的楼层 core.changeFloor(data.floorId, null, data.hero.loc, 0, callback, true); -}, - "flyTo": function (toId, callback) { - // 楼层传送器的使用,从当前楼层飞往toId - // 如果不能飞行请返回false - - var fromId = core.status.floorId; - - // 检查能否飞行 - if (!core.status.maps[fromId].canFlyTo || !core.status.maps[toId].canFlyTo) { - core.drawTip("无法飞往" + core.status.maps[toId].title +"!"); - return false; - } - - // 获得两个楼层的索引,以决定是上楼梯还是下楼梯 - var fromIndex = core.floorIds.indexOf(fromId), toIndex = core.floorIds.indexOf(toId); - var stair = fromIndex<=toIndex?"downFloor":"upFloor"; - // 地下层:同层传送至上楼梯 - if (fromIndex == toIndex && core.status.maps[fromId].underGround) stair = "upFloor"; - // 记录录像 - core.status.route.push("fly:"+toId); - // 传送 - core.ui.closePanel(); - core.changeFloor(toId, stair, null, null, callback); - - return true; }, "updateStatusBar": function () { // 更新状态栏