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); };