From 420a87b700b83c2138ca97f61c79e63569776199 Mon Sep 17 00:00:00 2001 From: strawberry <2806566736@.qq.com> Date: Mon, 18 Aug 2025 17:31:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=86=8C=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/actions.js | 20 +- libs/control.js | 5 +- libs/maps.js | 13 +- project/functions.js | 10 +- project/plugins.js | 437 +++++++++++++++++++++++++++++++++++++++---- 5 files changed, 427 insertions(+), 58 deletions(-) diff --git a/libs/actions.js b/libs/actions.js index e25afb8..d09f46e 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1241,18 +1241,19 @@ actions.prototype._clickBook = function (x, y) { ////// 怪物手册界面时,按下某个键的操作 ////// actions.prototype._keyDownBook = function (keycode) { - var pageinfo = core.ui._drawBook_pageinfo(); - if (keycode == 37) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - pageinfo.per_page); } - if (keycode == 38) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - 1); } - if (keycode == 39) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + pageinfo.per_page); } - if (keycode == 40) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + 1); } - if (keycode == 33) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data - pageinfo.per_page); } - if (keycode == 34) { core.playSound('光标移动'); core.ui.drawBook(core.status.event.data + pageinfo.per_page); } + if (core.book.isAnimate) return + if (keycode == 37) { core.book.turnleft() } + if (keycode == 38) { core.book.turnleft() } + if (keycode == 39) { core.book.turnright() } + if (keycode == 40) { core.book.turnright() } + if (keycode == 33) { core.book.turnleft() } + if (keycode == 34) { core.book.turnright()} return; } ////// 怪物手册界面时,放开某个键的操作 ////// actions.prototype._keyUpBook = function (keycode) { + if (core.book.isAnimate) return if (keycode == 27 || keycode == 88) { core.playSound('取消'); if (core.events.recoverEvents(core.status.event.interval)) { @@ -1263,15 +1264,16 @@ actions.prototype._keyUpBook = function (keycode) { core.ui._drawViewMaps(core.status.event.ui); } else core.ui.closePanel(); + core.book.close() return; } - if (keycode == 13 || keycode == 32 || keycode == 67) { + /*if (keycode == 13 || keycode == 32 || keycode == 67) { var data = core.status.event.data; if (data != null) { core.ui._drawBookDetail(data); } return; - } + }*/ } ////// 怪物手册属性显示界面时的点击操作 ////// diff --git a/libs/control.js b/libs/control.js index 773745f..543527a 100644 --- a/libs/control.js +++ b/libs/control.js @@ -194,7 +194,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { if (timestamp - core.animateFrame.globalTime <= core.values.animateSpeed) return; core.status.globalAnimateStatus++; - if (core.status.floorId) { + if (core.status.floorId) { // Global Animate core.status.globalAnimateObjs.forEach(function (block) { core.drawBlock(block, core.status.globalAnimateStatus); @@ -233,6 +233,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { } // Box animate core.drawBoxAnimate(); + if(core.status.event.id==="book"&&!core.book.isAnimate)core.book.update() core.animateFrame.globalTime = timestamp; }; @@ -1439,7 +1440,7 @@ control.prototype.checkBlock = function () { if (damage) { core.status.hero.hp -= damage; core.taskSystem.tasksInfo.forEach(v => v.tasks.forEach(a => { - if (a.type==="specialBlock"&&core.status.checkBlock.type[loc][a.specialType])a.has++ + if (a.type==="specialBlock"&&(!a.floorIds||a.floorIds.includes(core.status.floorId)) &&(core.status.checkBlock.type[loc]|| {})[a.specialType])a.has++ })) var text = Object.keys(core.status.checkBlock.type[loc] || {}).join(",") || "伤害"; diff --git a/libs/maps.js b/libs/maps.js index 6107008..5d05b25 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -2970,11 +2970,10 @@ maps.prototype.removeGlobalAnimate = function (x, y, name) { maps.prototype.drawBoxAnimate = function () { if (core.status.boxAnimateObjs.length == 0) return; // check ui2 - if (main.mode == 'play' && core.status.boxAnimateObjs.filter(function (one) { return one.bigImage }).length > 0 && !core.dymCanvas.ui2) { + if (main.mode == 'play' && core.status.boxAnimateObjs.filter(function (one) { return one.bigImage }).length > 0 && !core.dymCanvas.ui2) { core.createCanvas('ui2', 0, 0, core._PX_, core._PY_, 142); } core.clearMap('ui2'); - core.status.boxAnimateObjs.forEach(function (obj) { if (obj.bigImage) { var ctx = obj.ctx || 'ui2'; @@ -2983,14 +2982,18 @@ maps.prototype.drawBoxAnimate = function () { var actual_width = Math.min(per_width, obj.max_width || per_width), actual_height = per_height * actual_width / per_width; var x = obj.centerX - actual_width / 2, y = obj.centerY - actual_height / 2; core.clearMap(ctx, x, y, actual_width, actual_height); + if(!obj.nobackground){ core.fillRect(ctx, x, y, actual_width, actual_height, core.material.groundPattern); - core.strokeRect(ctx, x, y, actual_width, actual_height, 'gold', 2); + core.strokeRect(ctx, x, y, actual_width, actual_height, 'gold', 2) + }; core.drawImage(ctx, obj.bigImage, sx, sy, per_width, per_height, obj.centerX - actual_width / 2, obj.centerY - actual_height / 2, actual_width, actual_height); } else { var ctx = obj.ctx || 'ui'; - core.clearMap(ctx, obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight); - core.fillRect(ctx, obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight, core.material.groundPattern); + core.clearMap(ctx, obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight); + if(!obj.nobackground){ + core.fillRect(ctx, obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight,core.material.groundPattern); + } core.drawImage(ctx, obj.image, core.status.globalAnimateStatus % obj.animate * 32, obj.pos, 32, obj.height, obj.x, obj.y, obj.dw || 32, obj.dh || obj.height); } diff --git a/project/functions.js b/project/functions.js index 55fe4e7..c50b22c 100644 --- a/project/functions.js +++ b/project/functions.js @@ -192,7 +192,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.taskSystem.tasksInfo.forEach(v => v.tasks.forEach(a => { switch (a.type) { case "changeFloor": - a.has++ + if (!a.floorIds || a.floorId.includes(floorId)) a.has++ break; case "arrival": if (a.floorId === floorId) a.has = 1 @@ -433,9 +433,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (a.kill === enemyId && (!a.floorIds || a.floorIds.includes(core.status.floorId))) a.has++ break case "killLocs": - a.killLocs.forEach(b => { - if (x === b[0] && y === b[1] && core.status.floorId === b[2]) a.has++ - }) + if (core.status.floorId === a.floorId) { + a.killLocs.forEach(b => { + if (x === b[0] && y === b[1]) a.has++ + }) + } break case "killCount": if (!a.floorIds || a.floorIds.includes(core.status.floorId)) a.has++ diff --git a/project/plugins.js b/project/plugins.js index 3eca911..feba2d6 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2915,7 +2915,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 113, 120 ); - if (core.status.event.id === "viewMaps") { + if (core.status.event.id === "viewMaps" && core.status.event.data) { core.ui.statusBar._update_map(core.status.event.data.floorId); } else { core.ui.statusBar._update_map(); @@ -2931,7 +2931,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = uictx.globalAlpha = 1; } else { core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 113, 120); - if (core.status.event.id === "viewMaps") { + if (core.status.event.id === "viewMaps" && core.status.event.data) { core.ui.statusBar._update_map(core.status.event.data.floorId); } else { core.ui.statusBar._update_map(); @@ -3028,8 +3028,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.overupdate() if (main.dom.saveLoad && main.dom.saveLoad.style.display === "block") core.saveLoad.update(); - if (main.dom.book && main.dom.book.style.display === "block") - core.book.update() }; class StatusBar { @@ -5232,7 +5230,7 @@ let time=0 var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); - if ( + /*if ( !core.flags.enableEnemyPoint || (locEnemyInfo.atk == enemyInfo.atk && locEnemyInfo.def == enemyInfo.def && @@ -5241,24 +5239,24 @@ let time=0 ) { x = null; y = null; - } else { - // 检查enemys里面是否使用了存在的内容 - for (var i = 0; i < enemys.length; ++i) { - var one = enemys[i]; - if ( - id == one.id && - one.locs != null && - locEnemyInfo.atk == one.atk && - locEnemyInfo.def == one.def && - locEnemyInfo.hp == one.hp && - core.plugin.arrsame(locEnemyInfo.special, one.special) - ) { - one.locs.push([x, y]); - return; - } + } else {*/ + // 检查enemys里面是否使用了存在的内容 + for (var i = 0; i < enemys.length; ++i) { + var one = enemys[i]; + if ( + id == one.id && + one.locs != null && + locEnemyInfo.atk == one.atk && + locEnemyInfo.def == one.def && + locEnemyInfo.hp == one.hp && + core.plugin.arrsame(locEnemyInfo.special, one.special) + ) { + one.locs.push([x, y]); + return; } - enemyInfo = locEnemyInfo; } + enemyInfo = locEnemyInfo; + // } var id = enemy.id + ":" + x + ":" + y; if (used[id]) return; @@ -22113,6 +22111,254 @@ let time=0 const { Animation, linear, sleep, trigo } = core.plugin.animate + class BookInfo { + constructor() { + this.width = 300 + this.height = 400 + this.enemys = [] + this.page = 0 + this.floorId = "" + this.left = document.createElement("canvas") + this.right = document.createElement("canvas") + this.tempLeft = document.createElement("canvas") + this.tempRight = document.createElement("canvas") + this.left.width = 300; + this.left.height = 400; + this.right.width = 300; + this.right.height = 400; + this.tempLeft.width = 300; + this.tempLeft.height = 400; + this.tempRight.width = 300; + this.tempRight.height = 400; + this.left = this.left.getContext("2d") + this.right = this.right.getContext("2d") + this.tempLeft = this.tempLeft.getContext("2d") + this.tempRight = this.tempRight.getContext("2d") + this.animateObjs = {} + + } + getCurrentEnemys(floorId) { + this.floorId = floorId + this.enemys = core.enemys.getCurrentEnemys(floorId) + } + drawEmpty() { + core.clearMap(this.left) + core.clearMap(this.right) + core.setTextAlign(this.left, 'center'); + core.setTextAlign(this.right, 'center'); + core.fillText(this.left, "无恶意目标", 150, 214, '#999999', core.ui._buildFont(34, true)); + core.fillText(this.right, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true)); + } + drawBoxAnimate(ctx, dir) { + const blockInfo = core.getBlockInfo(this.enemys[this.page + dir].id) + if (blockInfo.bigImage) { + core.status.boxAnimateObjs.push({ + bigImage: blockInfo.bigImage, + face: blockInfo.face, + centerX: 150, + centerY: 50, + max_width: 60, + ctx: ctx, + nobackground: true + }); + } else if (blockInfo.height >= 48) { + var originEnemy = core.material.enemys[this.enemys[this.page + dir]] || {}; + if (originEnemy.is32x32 == null) { + originEnemy.is32x32 = core.ui._drawBook_is32x32(blockInfo); + } + if (originEnemy.is32x32) { + core.status.boxAnimateObjs.push({ + 'bgx': 134, + 'bgy': 34, + 'bgWidth': 32, + 'bgHeight': 32, + 'x': 134, + 'y': 34, + 'height': 32, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height + blockInfo.height - 32, + ctx: ctx, + nobackground: true + }); + } else { + var drawWidth = 32 * 32 / blockInfo.height; + core.status.boxAnimateObjs.push({ + 'bgx': 134, + 'bgy': 34, + 'bgWidth': 32, + 'bgHeight': 48, + 'x': 134, + 'y': 34, + 'dw': 32, + 'dh': 48, + 'height': blockInfo.height, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height, + ctx: ctx, + nobackground: true + }); + } + } else { + core.status.boxAnimateObjs.push({ + 'bgx': 134, + 'bgy': 34, + 'bgWidth': 32, + 'bgHeight': 32, + 'x': 134, + 'y': 34, + 'height': 32, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height, + ctx: ctx, + nobackground: true + }); + } + + + } + pageinfo() { + + } + drawTempLeft(dir) { + core.clearMap(this.tempLeft) + const enemy = this.enemys[this.page + dir] + core.setTextAlign(this.tempLeft, 'center') + core.fillText(this.tempLeft, enemy.name, 150, 120, "#000000", core.ui._buildFont(20, true)) + core.fillText(this.tempLeft, "基础属性", 150, 150, "#000000", core.ui._buildFont(14, true)) + core.setTextAlign(this.tempLeft, 'left') + core.fillText(this.tempLeft, "生命 " + enemy.hp, 30, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "攻击 " + enemy.atk, 120, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "防御 " + enemy.def, 210, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "法强 " + enemy.spell, 30, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "法抗 " + enemy.mdef + '%', 120, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "速度 " + enemy.speed, 210, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "金币 " + enemy.money, 30, 210, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempLeft, "经验 " + enemy.exp, 120, 210, "#000000", core.ui._buildFont(12, true)) + core.setTextAlign(this.tempLeft, 'center') + core.fillText(this.tempLeft, "特殊属性", 150, 230, "#000000", core.ui._buildFont(14, true)) + const specials = core.getSpecials() + core.enemys._calSpecialContent(enemy.id) + const hints = []; + for (let i = 0; i < specials.length; i++) { + if (core.hasSpecial(enemy, specials[i][0])) + hints.push(core.enemys._calSpecialContent(enemy.id, specials[i][1]) + + ":" + core.enemys._calSpecialContent(enemy.id, specials[i][2])); + } + if (hints.length == 0) hints.push("该怪物无特殊属性。"); + core.drawTextContent(this.tempLeft, hints.join('\n'), { + left: 30, + top: 240, + maxWidth: 220, + fontSize: 14, + lineHeight: 20, + color: "#000000" + }); + + } + drawTempRight(dir) { + core.clearMap(this.tempRight) + const enemy = this.enemys[this.page + dir] + core.maps.drawThumbnail(this.floorId, null, { ctx: this.tempRight, size: 0.4, x: 10, y: 220 }) + enemy.locs.forEach(v => { + this.tempRight.beginPath() + this.tempRight.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4) + this.tempRight.lineTo(10 + (32 * v[0] + 24) * 0.4, 220 + 32 * v[1] * 0.4 - 16 * 0.4) + this.tempRight.lineTo(10 + (32 * v[0] + 8) * 0.4, 220 + 32 * v[1] * 0.4 - 16 * 0.4) + this.tempRight.closePath() + this.tempRight.fillStyle = "#DD0000" + this.tempRight.fill() + }) + core.setTextAlign(this.tempRight, 'left') + core.fillText(this.tempRight, "出手 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempRight, "受击 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.tempRight, enemy.damage === "???" ? "你会死的哦~杂鱼❤~" : enemy.damage, 230, 50, "#FF0000", core.ui._buildFont(12, true)) + core.setTextAlign(this.tempRight, 'center'); + core.fillText(this.tempRight, "当前战斗情况", 150, 25, "#000000", core.ui._buildFont(16, true)) + core.fillText(this.tempRight, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true)); + } + drawLeft() { + core.clearMap(this.left) + const enemy = this.enemys[this.page] + core.setTextAlign(this.left, 'center') + core.fillText(this.left, enemy.name, 150, 120, "#000000", core.ui._buildFont(20, true)) + core.fillText(this.left, "基础属性", 150, 150, "#000000", core.ui._buildFont(14, true)) + core.setTextAlign(this.left, 'left') + core.fillText(this.left, "生命 " + enemy.hp, 30, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "攻击 " + enemy.atk, 120, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "防御 " + enemy.def, 210, 170, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "法强 " + enemy.spell, 30, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "法抗 " + enemy.mdef + '%', 120, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "速度 " + enemy.speed, 210, 190, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "金币 " + enemy.money, 30, 210, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.left, "经验 " + enemy.exp, 120, 210, "#000000", core.ui._buildFont(12, true)) + core.setTextAlign(this.left, 'center') + core.fillText(this.left, "特殊属性", 150, 230, "#000000", core.ui._buildFont(14, true)) + const specials = core.getSpecials() + core.enemys._calSpecialContent(enemy.id) + const hints = []; + for (let i = 0; i < specials.length; i++) { + if (core.hasSpecial(enemy, specials[i][0])) + hints.push(core.enemys._calSpecialContent(enemy.id, specials[i][1]) + + ":" + core.enemys._calSpecialContent(enemy.id, specials[i][2])); + } + if (hints.length == 0) hints.push("该怪物无特殊属性。"); + core.drawTextContent(this.left, hints.join('\n'), { + left: 30, + top: 240, + maxWidth: 220, + fontSize: 14, + lineHeight: 20, + color: "#000000" + }); + + } + drawRight() { + core.clearMap(this.right) + const enemy = this.enemys[this.page] + core.maps.drawThumbnail(this.floorId, null, { ctx: this.right, size: 0.4, x: 10, y: 220 }) + enemy.locs.forEach(v => { + this.right.beginPath() + this.right.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4) + this.right.lineTo(10 + (32 * v[0] + 24) * 0.4, 220 + 32 * v[1] * 0.4 - 16 * 0.4) + this.right.lineTo(10 + (32 * v[0] + 8) * 0.4, 220 + 32 * v[1] * 0.4 - 16 * 0.4) + this.right.closePath() + this.right.fillStyle = "#DD0000" + this.right.fill() + }) + core.setTextAlign(this.right, 'left') + core.fillText(this.right, "出手 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.right, "受击 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true)) + core.fillText(this.right, enemy.damage === "???" ? "你会死的哦~杂鱼❤~" : enemy.damage, 230, 50, "#FF0000", core.ui._buildFont(12, true)) + core.setTextAlign(this.right, 'center'); + core.fillText(this.right, "当前战斗情况", 150, 25, "#000000", core.ui._buildFont(16, true)) + core.fillText(this.right, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true)); + } + + clear() { + core.clearUI() + core.clearMap(this.left) + core.clearMap(this.right) + core.clearMap(this.tempLeft) + core.clearMap(this.tempRight) + } + + init(floorId) { + this.page = 0 + this.getCurrentEnemys(floorId) + if (this.enemys.length == 0) { + return this.drawEmpty(); + } + this.drawLeft() + this.drawRight() + this.drawBoxAnimate(this.left, 0) + + } + } + const bookInfo = new BookInfo() + core.bookInfo = bookInfo class Book { constructor() { this.width = 300 @@ -22139,8 +22385,19 @@ let time=0 }; const leftbox = makeBox([(676 - this.width * 2) / 2, (416 - this.height) / 2], [this.width, this.height]) const rightbox = makeBox([338, (416 - this.height) / 2], [this.width, this.height]) + const exitbox = makeBox([555, 365], [70, 35]) if (this.isAnimate) return - if (inRect(pos, leftbox)) { + if (inRect(pos, exitbox)) { + core.playSound('取消'); + if (core.events.recoverEvents(core.status.event.interval)) { + return; + } else if (core.status.event.ui != null) { + core.status.boxAnimateObjs = []; + core.ui._drawViewMaps(core.status.event.ui); + } else core.ui.closePanel(); + core.book.close() + return; + } else if (inRect(pos, leftbox)) { this.turnleft() } else if (inRect(pos, rightbox)) { @@ -22151,6 +22408,10 @@ let time=0 async turnleft() { if (this.page <= 1) return this.isAnimate = true + bookInfo.drawTempLeft(-1) + bookInfo.drawTempRight(-1) + bookInfo.drawBoxAnimate(bookInfo.tempLeft, -1) + core.drawBoxAnimate() await this.ani.time(1) .absolute() .mode(linear()).move(0, 0).n(1) @@ -22754,18 +23015,39 @@ let time=0 ctx.shadowBlur = 10; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; - + core.drawBoxAnimate() // 绘制左页 core.drawImage(ctx, this.paperpages[this.page - 1][0], 0, 0, 300, 400, dx, dy, this.width, this.height); - + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.left.canvas, 0, 0, 300, 400, dx, dy, this.width, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; // 绘制右页 core.drawImage(ctx, this.paperpages[this.page - 1][1], 0, 0, 300, 400, dx + this.width, dy, this.width, this.height); - - + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.right.canvas, 0, 0, 300, 400, dx + this.width, dy, this.width, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; //绘制上一页左页 core.drawImage(ctx, this.paperpages[this.page - 2][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, dx, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.tempLeft.canvas, 0, 0, this.ani.x / (this.width * 2) * 300, 400, dx, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; //绘制翻起的右页 core.drawImage(ctx, this.paperpages[this.page - 2][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, this.ani.x / 2 + dx, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.tempRight.canvas, 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, this.ani.x / 2 + dx, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; const gradientleft = ctx.createLinearGradient(dx + this.ani.x / 2 - 20, (416 - this.height) / 2, dx + this.ani.x / 2 + 10, (416 - this.height) / 2) gradientleft.addColorStop(0, "rgba(0,0,0,0)") gradientleft.addColorStop(0.67, "rgba(0,0,0,0.2)") @@ -22779,8 +23061,6 @@ let time=0 // 重置阴影 ctx.shadowColor = "transparent"; - - ctx.restore(); } this.ani.ticker.add(fn) @@ -22791,11 +23071,24 @@ let time=0 this.ani.ticker.clear() this.isAnimate = false this.page-- + bookInfo.page--; + [bookInfo.left, bookInfo.tempLeft] = [bookInfo.tempLeft, bookInfo.left]; + [bookInfo.right, bookInfo.tempRight] = [bookInfo.tempRight, bookInfo.right] + core.clearUI() + bookInfo.drawBoxAnimate(bookInfo.left, 0) + core.drawBoxAnimate() this.update() + core.clearMap(bookInfo.tempLeft) + core.clearMap(bookInfo.tempRight) + } async turnright() { if (this.page >= this.pagemax) return this.isAnimate = true + bookInfo.drawTempLeft(1) + bookInfo.drawTempRight(1) + bookInfo.drawBoxAnimate(bookInfo.tempLeft, 1) + core.drawBoxAnimate() await this.ani.time(1) .absolute() .mode(linear()).move(0, 0).n(1) @@ -23399,16 +23692,41 @@ let time=0 ctx.shadowBlur = 10; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; - + core.drawBoxAnimate() // 绘制左页 core.drawImage(ctx, this.paperpages[this.page - 1][0], 0, 0, 300, 400, dx, dy, this.width, this.height); - + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.left.canvas, 0, 0, 300, 400, dx, dy, this.width, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; // 绘制右页 core.drawImage(ctx, this.paperpages[this.page - 1][1], 0, 0, 300, 400, dx + this.width, dy, this.width, this.height); + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.right.canvas, 0, 0, 300, 400, dx + this.width, dy, this.width, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; //绘制翻起的左页 core.drawImage(ctx, this.paperpages[this.page][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.tempLeft.canvas, 0, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; //绘制下一页右页 core.drawImage(ctx, this.paperpages[this.page][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x / 2, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "transparent"; + core.drawImage(ctx, bookInfo.tempRight.canvas, 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x / 2, dy, this.ani.x / 2, this.height); + ctx.shadowColor = "rgba(0,0,0,0.5)"; + ctx.shadowBlur = 10; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; + + const gradientleft = ctx.createLinearGradient(676 - dx - this.ani.x, (416 - this.height) / 2, 676 - dx - this.ani.x - 20, (416 - this.height) / 2) gradientleft.addColorStop(1, "rgba(0,0,0,0)") gradientleft.addColorStop(0.2, "rgba(0,0,0,0.2)") @@ -23419,10 +23737,9 @@ let time=0 gradientright.addColorStop(0.33, "rgba(0,0,0,0.2)") gradientright.addColorStop(0, "rgba(0,0,0,0)") core.fillRect(ctx, 676 - dx - this.ani.x / 2 - 10, (416 - this.height) / 2, 30, this.height, gradientright) + // 重置阴影 ctx.shadowColor = "transparent"; - - ctx.restore(); } this.ani.ticker.add(fn) @@ -23433,7 +23750,15 @@ let time=0 this.ani.ticker.clear() this.isAnimate = false this.page++ + bookInfo.page++; + [bookInfo.left, bookInfo.tempLeft] = [bookInfo.tempLeft, bookInfo.left]; + [bookInfo.right, bookInfo.tempRight] = [bookInfo.tempRight, bookInfo.right] + core.clearUI() + bookInfo.drawBoxAnimate(bookInfo.left, 0) + core.drawBoxAnimate() this.update() + core.clearMap(bookInfo.tempLeft) + core.clearMap(bookInfo.tempRight) } paperTexture(dir, num = 0) { @@ -24728,21 +25053,26 @@ let time=0 // 绘制左页 core.drawImage(ctx, this.paperpages[this.page - 1][0], 0, 0, 300, 400, dx, dy, this.width, this.height); + // 绘制右页 core.drawImage(ctx, this.paperpages[this.page - 1][1], 0, 0, 300, 400, dx + this.width, dy, this.width, this.height); // 重置阴影 ctx.shadowColor = "transparent"; - - + core.drawImage(ctx, bookInfo.left.canvas, 0, 0, 300, 400, dx, dy, this.width, this.height) + core.drawImage(ctx, bookInfo.right.canvas, 0, 0, 300, 400, dx + this.width, dy, this.width, this.height) ctx.restore(); } setPage(num) { - const a = [] - for (let i = 0; i < num; i++) { - a.push([this.paperTexture('left'), this.paperTexture('right')]) + if (num === 1) { + this.paperpages = [ + [this.paperTexture('left'), this.paperTexture('right')] + ] + } else { + for (let i = 1; i < num; i++) { + this.paperpages.push([this.paperTexture('left'), this.paperTexture('right')]) + } } - this.paperpages = a this.pagemax = num } clearPage() { @@ -24762,12 +25092,31 @@ let time=0 if (this.page < 1) this.page = 1 this.background() } + close() { + this.clearPage() + bookInfo.clear() + this.page = 1 + book.style.display = 'none' + this.setPage(1) + } } core.book = new Book() + ////// 绘制怪物手册 ////// + ui.prototype.drawBook = function (index) { + var floorId = core.floorIds[(core.status.event.ui || {}).index] || core.status.floorId; + // 清除浏览地图时的光环缓存 + if (floorId != core.status.floorId && core.status.checkBlock) { + core.status.checkBlock.cache = {}; + } + core.clearUI() + bookInfo.init(floorId) + core.book.update() + if (bookInfo.enemys.length > 1) core.book.setPage(bookInfo.enemys.length) + } }, "存读档": function () { // 在此增加新插件 @@ -27562,20 +27911,24 @@ let time=0 this.floorIds = info.floorIds this.has = info.has ?? core.searchBlockWithFilter(block => block.event.cls.startsWith("enemy") && block.event.type === this.checkEnemyType, this.floorIds).length } else if (info.type === "kill") { + this.floorIds = info.floorIds this.kill = info.kill this.count = info.count this.has = info.has ?? 0 this.operator = info.operator } else if (info.type === "killLocs") { this.killLocs = info.killLocs + this.floorId = info.floorId this.count = info.count this.has = info.has ?? 0 this.operator = info.operator } else if (info.type === "killCount") { + this.floorIds = info.floorIds this.count = info.count this.has = info.has ?? 0 this.operator = info.operator } else if (info.type === "killSpecial") { + this.floorIds = info.floorIds this.killSpecial = info.killSpecial this.count = info.count this.has = info.has ?? 0 @@ -27584,11 +27937,13 @@ let time=0 this.floorIds = info.floorIds this.has = info.has ?? core.searchBlockWithFilter(block => block.event.cls.startsWith("enemy"), this.floorIds).length } else if (info.type === "specialBlock") { + this.floorIds = info.floorIds this.specialType = info.specialType this.count = info.count this.has = info.has ?? 0 this.operator = info.operator } else if (info.type === "changeFloor") { + this.floorIds = info.floorIds this.count = info.count this.has = info.has ?? 0 this.operator = info.operator @@ -27655,20 +28010,24 @@ let time=0 info.floorIds = this.floorIds info.has = this.has } else if (info.type === "kill") { + info.floorIds = this.floorIds info.kill = this.kill info.count = this.count info.has = this.has info.operator = this.operator } else if (info.type === "killLocs") { info.killLocs = this.killLocs + info.floorId = this.floorId info.count = this.locs.length info.has = this.has info.operator = this.operator } else if (info.type === "killCount") { + info.floorIds = this.floorIds info.count = this.count info.has = this.has info.operator = this.operator } else if (info.type === "killSpecial") { + info.floorIds = this.floorIds info.killSpecial = this.killSpecial info.count = this.count info.has = this.has @@ -27678,11 +28037,13 @@ let time=0 info.has = this.has } else if (info.type === "specialBlock") { info.specialType = this.specialType + info.floorIds = this.floorIds info.count = this.count info.has = this.has info.operator = this.operator } else if (info.type === "changeFloor") { info.count = this.count + info.floorIds = this.floorIds info.has = this.has info.operator = this.operator } else if (info.type === "arrival") {