From fdd65bc02824af52c0b9c5ab4a816d07c43006ca Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 2 Jun 2020 22:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=B7=83=E9=9F=B3=E6=95=88;=E6=80=AA?= =?UTF-8?q?=E7=89=A9=E6=89=8B=E5=86=8C48=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/events.js | 1 - libs/maps.js | 3 +-- libs/ui.js | 20 +++++++++++++++----- project/functions.js | 2 +- project/items.js | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/libs/events.js b/libs/events.js index a46fa395..21b76daa 100644 --- a/libs/events.js +++ b/libs/events.js @@ -2950,7 +2950,6 @@ events.prototype.jumpHero = function (ex, ey, time, callback) { var sx=core.status.hero.loc.x, sy=core.status.hero.loc.y; if (!core.isset(ex)) ex=sx; if (!core.isset(ey)) ey=sy; - core.playSound('jump.mp3'); var jumpInfo = core.maps.__generateJumpInfo(sx, sy, ex, ey, time || 500); jumpInfo.icon = core.material.icons.hero[core.getHeroLoc('direction')]; jumpInfo.width = core.material.icons.hero.width || 32; diff --git a/libs/maps.js b/libs/maps.js index 73f0798a..1c778f8d 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -1976,7 +1976,6 @@ maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) { var block = blockArr[0], blockInfo = blockArr[1]; var canvases = this._initDetachedBlock(blockInfo, sx, sy, block.event.animate !== false); this._moveDetachedBlock(blockInfo, 32 * sx, 32 * sy, 1, canvases); - core.playSound('jump.mp3'); var jumpInfo = this.__generateJumpInfo(sx, sy, ex, ey, time); jumpInfo.keep = keep; @@ -2164,7 +2163,7 @@ maps.prototype.drawBoxAnimate = function () { core.clearMap('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight); core.fillRect('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight, core.material.groundPattern); core.drawImage('ui', obj.image, core.status.globalAnimateStatus % obj.animate * 32, obj.pos, - 32, obj.height, obj.x, obj.y, 32, obj.height); + 32, obj.height, obj.x, obj.y, obj.dw || 32, obj.dh || obj.height); }); } diff --git a/libs/ui.js b/libs/ui.js index 771708f8..61fd58a5 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1915,11 +1915,21 @@ ui.prototype._drawBook_drawBox = function (index, enemy, top, pageinfo) { var img_top = border_top + 5, img_left = border_left + 5; core.strokeRect('ui', 22, border_top, 42, 42, '#DDDDDD', 2); var blockInfo = core.getBlockInfo(enemy.id); - core.status.boxAnimateObjs.push({ - 'bgx': border_left, 'bgy': border_top, 'bgWidth': 42, 'bgHeight': 42, - 'x': img_left, 'y': img_top, 'height': 32, 'animate': blockInfo.animate, - 'image': blockInfo.image, 'pos': blockInfo.posY * blockInfo.height - }); + if (blockInfo.height >= 42) { + var drawWidth = 42 * 32 / blockInfo.height; + core.status.boxAnimateObjs.push({ + 'bgx': border_left, 'bgy': border_top, 'bgWidth': 42, 'bgHeight': 42, + 'x': img_left - 5 + (42 - drawWidth) / 2, 'y': img_top - 5, 'dw': drawWidth, 'dh': 42, + 'height': blockInfo.height, 'animate': blockInfo.animate, + 'image': blockInfo.image, 'pos': blockInfo.posY * blockInfo.height + }); + } else { + core.status.boxAnimateObjs.push({ + 'bgx': border_left, 'bgy': border_top, 'bgWidth': 42, 'bgHeight': 42, + 'x': img_left, 'y': img_top, 'height': 32, 'animate': blockInfo.animate, + 'image': blockInfo.image, 'pos': blockInfo.posY * blockInfo.height + }); + } } ui.prototype._drawBook_drawName = function (index, enemy, top, left, width) { diff --git a/project/functions.js b/project/functions.js index 187a1569..4af024fa 100644 --- a/project/functions.js +++ b/project/functions.js @@ -228,7 +228,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (guards.length > 0) { // 记录flag,当前要参与支援的怪物 core.setFlag("__guards__" + x + "_" + y, guards); - var actions = []; + var actions = [{ "type": "playSound", "name": "jump.mp3" }]; // 增加支援的特效动画(图块跳跃) guards.forEach(function (g) { core.push(actions, { "type": "jump", "from": [g[0], g[1]], "to": [x, y], "time": 300, "keep": false, "async": true }); diff --git a/project/items.js b/project/items.js index 6ed8ea67..f081dd34 100644 --- a/project/items.js +++ b/project/items.js @@ -498,7 +498,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "跳跃靴", "text": "能跳跃到前方两格处", - "useItemEffect": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });", + "useItemEffect": "core.playSound(\"jump.mp3\"); core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });", "canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();" }, "skill1": {