From 6740f54f5a1d7267f80d7806a5c3f5f904a7e8c0 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sun, 8 Aug 2021 15:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E9=80=9A=E8=A1=8C=E5=BA=A6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 65 +++++++++++++++++++++++++++++++++++--- _server/editor_listen.js | 2 +- _server/editor_mappanel.js | 9 +++--- _server/table/comment.js | 17 ++++++++-- editor-mobile.html | 4 +-- editor.html | 5 +-- libs/maps.js | 15 ++++++--- 7 files changed, 96 insertions(+), 21 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index b7b8fdd6..58152d7d 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -54,7 +54,7 @@ function editor() { lastUsedDiv: document.getElementById('lastUsedDiv'), lastUsed: document.getElementById('lastUsed'), lastUsedCtx: document.getElementById('lastUsed').getContext('2d'), - lockMode: document.getElementById('lockMode'), + showMovable: document.getElementById('showMovable'), gameInject: document.getElementById('gameInject'), undoFloor: document.getElementById('undoFloor'), editorTheme: document.getElementById('editorTheme'), @@ -118,6 +118,8 @@ function editor() { // tile lockMode: false, + + showMovable: false, // 最近使用的图块 lastUsedType: null, @@ -375,9 +377,17 @@ editor.prototype.drawEventBlock = function () { if (editor.uivalues.bigmap) return this._drawEventBlock_bigmap(); var firstData = editor.game.getFirstData(); + // 不可通行性 + var movableArray = {}; + if (editor.uivalues.showMovable) { + movableArray = core.generateMovableArray() || {}; + fg.fillStyle = "rgba(0,0,0,0.4)"; + fg.fillRect(0, 0, core.__PIXELS__, core.__PIXELS__); + } for (var i=0;i 0) - color.push('#0000FF'); if (editor.currentFloorData.afterOpenDoor[loc]) color.push('#FF00FF'); return color; diff --git a/_server/editor_listen.js b/_server/editor_listen.js index 5f7c50a3..5f876bad 100644 --- a/_server/editor_listen.js +++ b/_server/editor_listen.js @@ -42,7 +42,7 @@ editor_listen_wrapper = function (editor) { editor.dom.lastUsed.onmouseup = editor.uifunctions.lastUsed_click; editor.dom.lastUsed.oncontextmenu = function (e) { e.preventDefault(); } editor.dom.clearLastUsedBtn.onclick = editor.uifunctions.clearLastUsedBtn_click; - editor.dom.lockMode.onchange = editor.uifunctions.lockMode_onchange; + editor.dom.showMovable.onchange = editor.uifunctions.showMovable_onchange; editor.dom.brushMod.onchange = editor.uifunctions.brushMod_onchange if (editor.dom.brushMod2) editor.dom.brushMod2.onchange = editor.uifunctions.brushMod2_onchange; diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index 1170537c..2adb4cac 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -774,12 +774,13 @@ editor_mappanel_wrapper = function (editor) { } /** - * editor.dom.lockMode.onchange + * editor.dom.showMovable.onchange * 点击【】 */ - editor.uifunctions.lockMode_onchange = function () { - printf('锁定模式开启下将不再点击空白处自动保存,请谨慎操作。'); - editor.uivalues.lockMode = editor.dom.lockMode.checked; + editor.uifunctions.showMovable_onchange = function () { + printf('此模式下将显示每个点的不可通行状态。
请注意,修改了图块属性的不可出入方向后需要刷新才会正确显示在地图上。'); + editor.uivalues.showMovable = editor.dom.showMovable.checked; + editor.drawEventBlock(); } /** diff --git a/_server/table/comment.js b/_server/table/comment.js index 055a2894..ddff7eb2 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -627,8 +627,18 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "prefix": ["上: ", "下: ", "
左: ", "右: "], "key": ["up", "down", "left", "right"] }, - "_docs": "不可通行性", - "_data": "该点不可通行的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表该点不能往上和左走" + "_docs": "不可出方向", + "_data": "该点不可通行出的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果" + }, + "cannotMoveIn": { + "_leaf": true, + "_type": "checkboxSet", + "_checkboxSet": { + "prefix": ["上: ", "下: ", "
左: ", "右: "], + "key": ["up", "down", "left", "right"] + }, + "_docs": "不可入方向", + "_data": "该点不可通行入的方向 \n 可以在这里定义从哪个方向前往该点,可以达到悬崖之类的效果" }, } } @@ -664,7 +674,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "afterGetItem": {}, "afterOpenDoor": {}, "autoEvent": {}, - "cannotMove": {} + "cannotMove": {}, + "cannotMoveIn": {} } } } \ No newline at end of file diff --git a/editor-mobile.html b/editor-mobile.html index 40830608..77188c74 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -357,8 +357,8 @@ - 锁定 - 通行度 + diff --git a/editor.html b/editor.html index f533cba1..351dec2d 100644 --- a/editor.html +++ b/editor.html @@ -316,8 +316,8 @@ - 锁定 - 通行度 + @@ -348,6 +348,7 @@ +
diff --git a/libs/maps.js b/libs/maps.js index 7aa510fb..3c41af5f 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -23,6 +23,8 @@ maps.prototype._initFloors = function (floorId) { // 战前事件兼容性 if (!core.floors[floorId].beforeBattle) core.floors[floorId].beforeBattle = {} + // cannotMoveIn兼容性 + if (!core.floors[floorId].cannotMoveIn) core.floors[floorId].cannotMoveIn = {} } maps.prototype._resetFloorImages = function () { @@ -74,7 +76,8 @@ maps.prototype.loadFloor = function (floorId, map) { maps.prototype._loadFloor_doNotCopy = function () { return [ "firstArrive", "eachArrive", "blocks", "parallelDo", "map", "bgmap", "fgmap", - "events", "changeFloor", "beforeBattle", "afterBattle", "afterGetItem", "afterOpenDoor", "cannotMove" + "events", "changeFloor", "beforeBattle", "afterBattle", "afterGetItem", "afterOpenDoor", + "cannotMove", "cannotMoveIn" ]; } @@ -725,15 +728,19 @@ maps.prototype._canMoveHero_checkPoint = function (x, y, direction, floorId, arr if (nx < 0 || ny < 0 || nx >= core.floors[floorId].width || ny >= core.floors[floorId].height) return false; - // 2. 检查该点素材的 cannotOut 和下一个点的 cannotIn + // 2. 检查下个点的 cannotMoveIn + if (core.inArray((core.floors[floorId].cannotMoveIn || {})[nx + "," + ny], core.turnDirection(":back", direction))) + return false; + + // 3. 检查该点素材的 cannotOut 和下一个点的 cannotIn if (this._canMoveHero_checkCannotInOut(Object.keys(arrays).map(function (name) { return arrays[name][y][x]; }), "cannotOut", direction)) return false; if (this._canMoveHero_checkCannotInOut(Object.keys(arrays).map(function (name) { return arrays[name][ny][nx]; }), "cannotIn", direction)) return false; - // 3. 检查是否能进将死的领域 + // 4. 检查是否能进将死的领域 if (floorId == core.status.floorId && !core.flags.canGoDeadZone && !core.status.lockControl && - Math.max(core.status.hero.hp, 1) <= (core.status.checkBlock.damage[nx + "," + ny]||0) && arrays.eventArray[ny][nx] == 0) + Math.max(core.status.hero.hp, 1) <= ((core.status.checkBlock.damage||{})[nx + "," + ny]||0) && arrays.eventArray[ny][nx] == 0) return false; return true;