From 3bd0b2eec982c593ec9151803c34c733535e92f0 Mon Sep 17 00:00:00 2001 From: bdf1 Date: Wed, 4 Jan 2023 05:45:33 +1300 Subject: [PATCH] =?UTF-8?q?fix(nandu):=20=E9=9A=BE=E5=BA=A6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=97=B6=E5=9C=A8=E7=8A=B6=E6=80=81=E6=A0=8F=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BB=A5=E5=8F=8A=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E6=9C=89=E5=93=8D=E5=BA=94=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/functions.js | 13 ++++++++- project/plugins.js | 69 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/project/functions.js b/project/functions.js index 8250304..62c805a 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1004,7 +1004,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (core.isReplaying() && vertical != null) return vertical; return core.domStyle.isVertical; } - + if (core.status.floorId == "nandu") { + var h = -1; + if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1; + if (h > 0) { + core.actions._clickAction(0, Math.floor(py / 16), 1, py) + } + } // 如果正在执行事件,则忽略 if (core.status.lockControl) return; // 如果当前正在行走,则忽略;也可以使用 core.waitHeroToStop(callback) 来停止行走再回调执行脚本 @@ -1739,6 +1745,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = fill(step, 140, 455, '#ffffff'); setTimeout(function(){core.ui.drawStatusBar();}, 100); } + if (core.status.floorId == "nandu") { + core.dom.statusCanvas.width *= 1; + core.dom.statusCanvas.style.zIndex=80; + } + else core.dom.statusCanvas.style.zIndex=50; } } else if (core.flags.extendToolbar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏 if (!core.dymCanvas['status']) diff --git a/project/plugins.js b/project/plugins.js index 83310e2..f585c6e 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1080,8 +1080,71 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50); core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30); core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30); - - + main.dom.statusCanvas.onmousedown = main.dom.statusCanvas.onclick; + main.dom.statusCanvas.onclick = null; + main.dom.statusCanvas.onmousemove = function(e) { + try { + e.stopPropagation(); + if (e == null) return; + var t = main.core.actions._getClickLoc(e.clientX, e.clientY); + px = Math.floor(t.x / core.domStyle.scale); + py = Math.floor(t.y / core.domStyle.scale); + if (core.status.floorId == "nandu") { + var h = -1; + if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1; + if (h > 0 && h != core.getFlag("hard") && px < 160) { + core.actions._clickAction(0, Math.floor(py / 16), 1, py); + } + } + } catch (ee) { console.error(ee) } + } + core.actions._sys_onmove = function (x, y, px, py) { + if (core.status.floorId == "nandu") { + var h = -1; + if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1; + if (h > 0 && h != core.getFlag("hard") && px < 160) { + core.actions._clickAction(0, Math.floor(py / 16), 1, py); + } + } + if (core.status.lockControl) return false; + + if (core.status.preview.dragging) { + core.setViewport(core.bigmap.offsetX - px + core.status.preview.px, core.bigmap.offsetY - py + core.status.preview.py); + core.status.preview.px = px; + core.status.preview.py = py; + return true; + } + if (core.status.preview.prepareDragging) { + if (Math.abs(px - core.status.preview.px) <= 20 && Math.abs(py - core.status.preview.py) <= 20) + return true; + else core.status.preview.prepareDragging = false; + } + + clearTimeout(core.timeout.onDownTimeout); + core.timeout.onDownTimeout = null; + + if ((core.status.stepPostfix || []).length > 0) { + var pos = { 'x': parseInt((px + core.bigmap.offsetX) / 32), 'y': parseInt((py + core.bigmap.offsetY) / 32) }; + var pos0 = core.status.stepPostfix[core.status.stepPostfix.length - 1]; + var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]; + var max = 0, index = 4; + for (var ii = 0; ii < 4; ii++) { + if (directionDistance[ii] > max) { + index = ii; + max = directionDistance[ii]; + } + } + pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index] + if (pos) { + pos.x += pos0.x; + pos.y += pos0.y; + core.status.stepPostfix.push(pos); + core.fillRect('ui', pos.x * 32 + 12 - core.bigmap.offsetX, pos.y * 32 + 12 - core.bigmap.offsetY, 8, 8, '#bfbfbf'); + } + } + return true; + } + core.actions.registerAction('onmove', '_sys_onmove', core.actions._sys_onmove, 0); @@ -3830,7 +3893,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // 准备渐变 this.maskPrepare = function () { // 执行后画面将凝固 - core.createCanvas("mask", 0, 0, core.__PIXELS__, core.__PIXELS__, 155); + core.ui.createCanvas2("mask", 0, 0, core.__PIXELS__, core.__PIXELS__, 155); for (var m in core.canvas) { core.dymCanvas.mask.drawImage(core.canvas[m].canvas, 0, 0); };