From dd96cbb9336267096c38abc8c8bc735e6d1f531d Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 19 Aug 2021 16:12:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E4=BC=A4=E9=AB=98=E6=B8=85=20&=20?= =?UTF-8?q?=E5=8F=AF=E9=80=9A=E8=A1=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 88 +++++++++++++++++++++++++++++++++------------- libs/control.js | 23 ++++-------- libs/enemys.js | 8 +++-- libs/ui.js | 4 ++- project/plugins.js | 3 +- 5 files changed, 82 insertions(+), 44 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index de4ca35e..8bf28c04 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -396,20 +396,40 @@ editor.prototype.drawEventBlock = function () { var directions = (movableArray[x]||{})[y]; if (directions == null) continue; if (!directions.includes('left') && x != 0) { - core.drawLine(fg, 32 * i + 1, 32 * j + 10, 32 * i + 1, 32 * j + 22, '#FF0000', 2); - core.fillPolygon(fg, [[32 * i + 9, 32 * j + 12], [32 * i + 1, 32 * j + 16], [32 * i + 9, 32 * j + 20]], '#FF0000'); + var ndirections = (movableArray[x-1]||{})[y]; + if (ndirections != null && !ndirections.includes('right')) { + core.drawLine(fg, 32 * i + 1, 32 * j + 6, 32 * i + 1, 32 * j + 26, '#FF0000', 2); + } else { + core.drawLine(fg, 32 * i + 1, 32 * j + 10, 32 * i + 1, 32 * j + 22, '#FF0000', 2); + core.fillPolygon(fg, [[32 * i + 9, 32 * j + 12], [32 * i + 1, 32 * j + 16], [32 * i + 9, 32 * j + 20]], '#FF0000'); + } } if (!directions.includes('right') && x != editor.currentFloorData.width - 1) { - core.drawLine(fg, 32 * i + 31, 32 * j + 10, 32 * i + 31, 32 * j + 22, '#FF0000', 2); - core.fillPolygon(fg, [[32 * i + 23, 32 * j + 12], [32 * i + 31, 32 * j + 16], [32 * i + 23, 32 * j + 20]], '#FF0000'); + var ndirections = (movableArray[x+1]||{})[y]; + if (ndirections != null && !ndirections.includes('left')) { + core.drawLine(fg, 32 * i + 31, 32 * j + 6, 32 * i + 31, 32 * j + 26, '#FF0000', 2); + } else { + core.drawLine(fg, 32 * i + 31, 32 * j + 10, 32 * i + 31, 32 * j + 22, '#FF0000', 2); + core.fillPolygon(fg, [[32 * i + 23, 32 * j + 12], [32 * i + 31, 32 * j + 16], [32 * i + 23, 32 * j + 20]], '#FF0000'); + } } if (!directions.includes('up') && y != 0) { - core.drawLine(fg, 32 * i + 10, 32 * j + 1, 32 * i + 22, 32 * j + 1, '#FF0000', 2); - core.fillPolygon(fg, [[32 * i + 12, 32 * j + 9], [32 * i + 16, 32 * j + 1], [32 * i + 20, 32 * j + 9]], '#FF0000'); + var ndirections = movableArray[x][y-1]; + if (ndirections != null && !ndirections.includes('down')) { + core.drawLine(fg, 32 * i + 6, 32 * j + 1, 32 * i + 26, 32 * j + 1, '#FF0000', 2); + } else { + core.drawLine(fg, 32 * i + 10, 32 * j + 1, 32 * i + 22, 32 * j + 1, '#FF0000', 2); + core.fillPolygon(fg, [[32 * i + 12, 32 * j + 9], [32 * i + 16, 32 * j + 1], [32 * i + 20, 32 * j + 9]], '#FF0000'); + } } if (!directions.includes('down') && y != editor.currentFloorData.height - 1) { - core.drawLine(fg, 32 * i + 10, 32 * j + 31, 32 * i + 22, 32 * j + 31, '#FF0000', 2); - core.fillPolygon(fg, [[32 * i + 12, 32 * j + 23], [32 * i + 16, 32 * j + 31], [32 * i + 20, 32 * j + 23]], '#FF0000'); + var ndirections = movableArray[x][y+1]; + if (ndirections != null && !ndirections.includes('up')) { + core.drawLine(fg, 32 * i + 6, 32 * j + 31, 32 * i + 26, 32 * j + 31, '#FF0000', 2); + } else { + core.drawLine(fg, 32 * i + 10, 32 * j + 31, 32 * i + 22, 32 * j + 31, '#FF0000', 2); + core.fillPolygon(fg, [[32 * i + 12, 32 * j + 23], [32 * i + 16, 32 * j + 31], [32 * i + 20, 32 * j + 23]], '#FF0000'); + } } } } @@ -471,28 +491,48 @@ editor.prototype._drawEventBlock_bigmap = function () { var directions = (movableArray[i]||{})[j]; if (directions == null) continue; if (!directions.includes('left') && i != 0) { - core.drawLine(fg, info.left + size * i, info.top + size * j + size / 3, info.left + size * i + 1, info.top + size * j + size * 2 / 3, '#FF0000', 2); - core.fillPolygon(fg, [[info.left + size * i + size / 4, info.top + size * j + size * 3 / 8], - [info.left + size * i, info.top + size * j + size / 2], - [info.left + size * i + size / 4, info.top + size * j + size * 5 / 8]], '#FF0000'); + var ndirections = (movableArray[i-1]||{})[j]; + if (ndirections != null && !ndirections.includes('right')) { + core.drawLine(fg, info.left + size * i, info.top + size * j + size / 4, info.left + size * i, info.top + size * j + size * 3 / 4, '#FF0000', 2); + } else { + core.drawLine(fg, info.left + size * i, info.top + size * j + size / 3, info.left + size * i, info.top + size * j + size * 2 / 3, '#FF0000', 2); + core.fillPolygon(fg, [[info.left + size * i + size / 4, info.top + size * j + size * 3 / 8], + [info.left + size * i, info.top + size * j + size / 2], + [info.left + size * i + size / 4, info.top + size * j + size * 5 / 8]], '#FF0000'); + } } if (!directions.includes('right') && i != editor.currentFloorData.width - 1) { - core.drawLine(fg, info.left + size * i + size, info.top + size * j + size / 3, info.left + size * i + size, info.top + size * j + size * 2 / 3, '#FF0000', 2); - core.fillPolygon(fg, [[info.left + size * i + size * 3 / 4, info.top + size * j + size * 3 / 8], - [info.left + size * i + size, info.top + size * j + size / 2], - [info.left + size * i + size * 3 / 4, info.top + size * j + size * 5 / 8]], '#FF0000'); + var ndirections = (movableArray[i+1]||{})[j]; + if (ndirections != null && !ndirections.includes('left')) { + core.drawLine(fg, info.left + size * i + size, info.top + size * j + size / 4, info.left + size * i + size, info.top + size * j + size * 3 / 4, '#FF0000', 2); + } else { + core.drawLine(fg, info.left + size * i + size, info.top + size * j + size / 3, info.left + size * i + size, info.top + size * j + size * 2 / 3, '#FF0000', 2); + core.fillPolygon(fg, [[info.left + size * i + size * 3 / 4, info.top + size * j + size * 3 / 8], + [info.left + size * i + size, info.top + size * j + size / 2], + [info.left + size * i + size * 3 / 4, info.top + size * j + size * 5 / 8]], '#FF0000'); + } } if (!directions.includes('up') && j != 0) { - core.drawLine(fg, info.left + size * i + size / 3, info.top + size * j, info.left + size * i + size * 2 / 3, info.top + size * j, '#FF0000', 2); - core.fillPolygon(fg, [[info.left + size * i + size * 3 / 8, info.top + size * j + size / 4], - [info.left + size * i + size / 2, info.top + size * j], - [info.left + size * i + size * 5 / 8, info.top + size * j + size / 4]], '#FF0000'); + var ndirections = movableArray[i][j-1]; + if (ndirections != null && !ndirections.includes('down')) { + core.drawLine(fg, info.left + size * i + size / 4, info.top + size * j, info.left + size * i + size * 3 / 4, info.top + size * j, '#FF0000', 2); + } else { + core.drawLine(fg, info.left + size * i + size / 3, info.top + size * j, info.left + size * i + size * 2 / 3, info.top + size * j, '#FF0000', 2); + core.fillPolygon(fg, [[info.left + size * i + size * 3 / 8, info.top + size * j + size / 4], + [info.left + size * i + size / 2, info.top + size * j], + [info.left + size * i + size * 5 / 8, info.top + size * j + size / 4]], '#FF0000'); + } } if (!directions.includes('down') && j != editor.currentFloorData.height - 1) { - core.drawLine(fg, info.left + size * i + size / 3, info.top + size * j + size - 1, info.left + size * i + size * 2 / 3, info.top + size * j + size - 1, '#FF0000', 2); - core.fillPolygon(fg, [[info.left + size * i + size * 3 / 8, info.top + size * j + size * 3 / 4], - [info.left + size * i + size / 2, info.top + size * j + size], - [info.left + size * i + size * 5 / 8, info.top + size * j + size * 3 / 4]], '#FF0000'); + var ndirections = movableArray[i][j+1]; + if (ndirections != null && !ndirections.includes('up')) { + core.drawLine(fg, info.left + size * i + size / 4, info.top + size * j + size, info.left + size * i + size * 3 / 4, info.top + size * j + size, '#FF0000', 2); + } else { + core.drawLine(fg, info.left + size * i + size / 3, info.top + size * j + size, info.left + size * i + size * 2 / 3, info.top + size * j + size, '#FF0000', 2); + core.fillPolygon(fg, [[info.left + size * i + size * 3 / 8, info.top + size * j + size * 3 / 4], + [info.left + size * i + size / 2, info.top + size * j + size], + [info.left + size * i + size * 5 / 8, info.top + size * j + size * 3 / 4]], '#FF0000'); + } } } } diff --git a/libs/control.js b/libs/control.js index 45588528..c3460ad0 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1303,15 +1303,9 @@ control.prototype.drawDamage = function (ctx) { control.prototype._drawDamage_draw = function (ctx, onMap) { if (!core.hasItem('book')) return; - // 双缓冲 - var cacheCtx = core.bigmap.cacheCanvas; - cacheCtx.canvas.width = ctx.canvas.width; - cacheCtx.canvas.height = ctx.canvas.height; - cacheCtx.clearRect(0, 0, cacheCtx.canvas.width, cacheCtx.canvas.height); - if (onMap && core.bigmap.v2) cacheCtx.translate(32, 32); - core.setFont(cacheCtx, "bold 11px Arial"); - core.setTextAlign(cacheCtx, 'left'); + core.setFont(ctx, "bold 11px Arial"); + core.setTextAlign(ctx, 'left'); core.status.damage.data.forEach(function (one) { var px = one.px, py = one.py; if (onMap && core.bigmap.v2) { @@ -1320,10 +1314,10 @@ control.prototype._drawDamage_draw = function (ctx, onMap) { if (px < -32 * 2 || px > core.__PIXELS__ + 32 || py < -32 || py > core.__PIXELS__ + 32) return; } - core.fillBoldText(cacheCtx, one.text, px, py, one.color); + core.fillBoldText(ctx, one.text, px, py, one.color); }); - core.setTextAlign(cacheCtx, 'center'); + core.setTextAlign(ctx, 'center'); core.status.damage.extraData.forEach(function (one) { var px = one.px, py = one.py; if (onMap && core.bigmap.v2) { @@ -1332,13 +1326,10 @@ control.prototype._drawDamage_draw = function (ctx, onMap) { if (px < -32 || px > core.__PIXELS__ + 32 || py < -32 || py > core.__PIXELS__ + 32) return; } - var alpha = core.setAlpha(cacheCtx, one.alpha); - core.fillBoldText(cacheCtx, one.text, px, py, one.color); - core.setAlpha(cacheCtx, alpha); + var alpha = core.setAlpha(ctx, one.alpha); + core.fillBoldText(ctx, one.text, px, py, one.color); + core.setAlpha(ctx, alpha); }); - cacheCtx.translate(0, 0); - - core.drawImage(ctx, cacheCtx.canvas, onMap && core.bigmap.v2 ? -32 : 0, onMap && core.bigmap.v2 ? -32 : 0); } // ------ 录像相关 ------ // diff --git a/libs/enemys.js b/libs/enemys.js index 0fb5e49d..722e6287 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -460,11 +460,15 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x e.damage = this.getDamage(enemy, x, y, floorId); e.critical = critical[0]; e.criticalDamage = critical[1]; - var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; - e.defDamage = this.getDefDamage(enemy, ratio, x, y, floorId); + e.defDamage = this._getCurrentEnemys_addEnemy_defDamage(enemy, x, y, floorId); enemys.push(e); } +enemys.prototype._getCurrentEnemys_addEnemy_defDamage = function (enemy, x, y, floorId) { + var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; + return this.getDefDamage(enemy, ratio, x, y, floorId); +} + enemys.prototype._getCurrentEnemys_sort = function (enemys) { return enemys.sort(function (a, b) { if (a.damage == b.damage) { diff --git a/libs/ui.js b/libs/ui.js index a359e5a4..279a580f 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2069,6 +2069,7 @@ ui.prototype._drawCursor = function () { if (automaticRoute.cursorY == null) automaticRoute.cursorY = core.getHeroLoc('y'); automaticRoute.cursorX = core.clamp(automaticRoute.cursorX, 0, this.LAST); + automaticRoute.cursorY = core.clamp(automaticRoute.cursorY, 0, this.LAST); core.status.event.id = 'cursor'; core.lockControl(); core.clearUI(); @@ -2524,7 +2525,7 @@ ui.prototype.drawFly = function(page) { var lines = core.splitLines('ui', title, 120, this._buildFont(19, true)); var start_y = middle - (lines.length - 1) * 11; for (var i in lines) { - core.fillText('ui', lines[i], this.PIXEL - 60, start_y); + core.fillText('ui', lines[i], this.PIXEL - 60, start_y, '#FFFFFF'); start_y += 22; } @@ -3386,6 +3387,7 @@ ui.prototype.createCanvas = function (name, x, y, width, height, z) { newCanvas.style.top = y * core.domStyle.scale + 'px'; newCanvas.style.zIndex = z; newCanvas.style.position = 'absolute'; + newCanvas.style.pointerEvents = 'none'; core.dymCanvas[name] = newCanvas.getContext('2d'); core.maps._setHDCanvasSize(core.dymCanvas[name], width, height); core.dom.gameDraw.appendChild(newCanvas); diff --git a/project/plugins.js b/project/plugins.js index 254d451d..6c2b8969 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -356,7 +356,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层 // 另外 请注意加入两个新图层 会让大地图的性能降低一些 // 插件作者:ad - var __enable = false; + var __enable = true; if (!__enable) return; // 创建新图层 @@ -1054,6 +1054,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.drawTip = _drawTip; core.control.playSound = _playSound; core.status.route = core.status.route.slice(0, routeLength); + core.control._bindRoutePush(); // 插入事件:改变角色行走图并进行楼层切换 var toFloorId = data.floorId || core.status.floorId;