From 84ed897a4feedcc2bb59a366df3a770520ba6210 Mon Sep 17 00:00:00 2001 From: unanmed <90094606+unanmed@users.noreply.github.com> Date: Wed, 26 Apr 2023 04:54:35 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=2034154?= =?UTF-8?q?e77c143e04119dfdfa05190a68775ddc006=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/ui.js | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index 064fce6..0b098d8 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -942,19 +942,40 @@ ui.prototype.clearUI = function () { ////// 左上角绘制一段提示 ////// ui.prototype.drawTip = function (text, id, frame) { - let t = - text + - ' [' + - core.status.hero.loc.x + - ',' + - core.status.hero.loc.y + - ',' + - core.status.floorId + - '] '; - if (core.status.floorId === 'tower6') - t += core.searchBlockWithFilter(v => v.event.cls === 'enemys').length; - - console.log(t); + text = core.replaceText(text) || ''; + var realText = this._getRealContent(text); + var one = { + text: text, + textX: 21, + width: 26 + core.calWidth('data', realText, '16px Arial'), + opacity: 0.1, + stage: 1, + frame: frame || 0, + time: 0 + }; + if (id != null) { + var info = core.getBlockInfo(id); + if (info == null || !info.image || info.bigImage) { + // 检查状态栏图标 + if (core.statusBar.icons[id] instanceof Image) { + info = { + image: core.statusBar.icons[id], + posX: 0, + posY: 0, + height: 32 + }; + } else info = null; + } + if (info != null) { + one.image = info.image; + one.posX = info.posX; + one.posY = info.posY; + one.height = info.height; + one.textX += 24; + one.width += 24; + } + } + core.animateFrame.tip = one; }; ui.prototype._drawTip_drawOne = function (tip) {