From d9daac54d3d29e93d611a1d0d31b42fb5a4d9fca Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Sat, 2 Mar 2024 15:35:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=8F=E8=A7=88=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=80=AA=E7=89=A9=E6=89=8B=E5=86=8C=20&=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/events.js | 17 +++++--- public/project/functions.js | 7 ++++ src/panel/enemyCritical.vue | 2 +- src/plugin/game/fx/rewrite.ts | 2 +- src/types/event.d.ts | 6 ++- src/ui/book.vue | 78 +++++++++++++++++++---------------- src/ui/bookDetail.vue | 2 +- src/ui/toolbox.vue | 2 +- 8 files changed, 70 insertions(+), 46 deletions(-) diff --git a/public/libs/events.js b/public/libs/events.js index 3ee48cf..ad1a5aa 100644 --- a/public/libs/events.js +++ b/public/libs/events.js @@ -4497,24 +4497,31 @@ events.prototype._checkLvUp_check = function () { }; ////// 尝试使用道具 ////// -events.prototype.tryUseItem = function (itemId) { +events.prototype.tryUseItem = function (itemId, noRoute, callback) { if (itemId == 'book') { core.ui.closePanel(); - return core.openBook(false); + core.openBook(false); + callback(); + return; } if (itemId == 'fly') { core.ui.closePanel(); - return core.useFly(false); + core.useFly(false); + callback(); + return; } if (itemId == 'centerFly') { core.ui.closePanel(); - return core.ui._drawCenterFly(); + core.ui._drawCenterFly(); + callback(); + return; } if (core.canUseItem(itemId)) { core.ui.closePanel(); - core.useItem(itemId); + core.useItem(itemId, noRoute, callback); } else { core.playSound('操作失败'); core.drawTip('当前无法使用' + core.material.items[itemId].name, itemId); } + callback(); }; diff --git a/public/project/functions.js b/public/project/functions.js index 6abc5c3..449a00f 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -561,6 +561,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { // 判定能否瞬移到该点 if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y); if (ignoreSteps >= 0) { + // 中毒也允许瞬移 + if (core.hasFlag('poison')) { + var damage = ignoreSteps * core.values.poisonDamage; + if (damage >= core.status.hero.hp) return false; + core.status.hero.statistics.poisonDamage += damage; + core.status.hero.hp -= damage; + } core.clearMap('hero'); // 获得勇士最后的朝向 var lastDirection = diff --git a/src/panel/enemyCritical.vue b/src/panel/enemyCritical.vue index 0f52b15..99e4142 100644 --- a/src/panel/enemyCritical.vue +++ b/src/panel/enemyCritical.vue @@ -214,7 +214,7 @@ onMounted(() => { const style = getComputedStyle(div); const width = parseFloat(style.width); - const height = window.innerHeight / 5; + const height = isMobile ? window.innerHeight / 7 : window.innerHeight / 5; const c = critical.value!; const d = def.value!; diff --git a/src/plugin/game/fx/rewrite.ts b/src/plugin/game/fx/rewrite.ts index 69b9e9e..5dfe3b3 100644 --- a/src/plugin/game/fx/rewrite.ts +++ b/src/plugin/game/fx/rewrite.ts @@ -46,7 +46,7 @@ export function init() { damageCanvas = '__damage_' + x + '_' + y; const ctx = core.createCanvas(damageCanvas, 0, 0, 32, 32, 65); ctx.textAlign = 'left'; - ctx.font = '14px normal'; + ctx.font = 'bold 11px Arial'; core.fillBoldText(ctx, damage, 1, 31, color as string); if (core.flags.displayCritical) { const critical = enemy.calCritical(1); diff --git a/src/types/event.d.ts b/src/types/event.d.ts index 382eebe..f19d62b 100644 --- a/src/types/event.d.ts +++ b/src/types/event.d.ts @@ -760,7 +760,11 @@ interface Events extends EventData { * @example core.tryUseItem('pickaxe'); // 尝试使用破墙镐 * @param itemId 道具id,其中敌人手册、传送器和飞行器会被特殊处理 */ - tryUseItem(itemId: ItemIdOf<'tools' | 'constants'>): void; + tryUseItem( + itemId: ItemIdOf<'tools' | 'constants'>, + noRoute?: boolean, + callback?: () => void + ): void; _sys_battle(data: Block, callback?: () => void): void; diff --git a/src/ui/book.vue b/src/ui/book.vue index 722921e..86662b2 100644 --- a/src/ui/book.vue +++ b/src/ui/book.vue @@ -60,6 +60,8 @@ const floorId = // @ts-ignore core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId; +console.log(floorId); + const enemy = core.getCurrentEnemys(floorId); const toShow: ToShowEnemy[] = enemy.map(v => getDetailedEnemy(v.enemy, floorId) @@ -121,11 +123,13 @@ async function exit() { const hold = mainUi.holdOn(); mainUi.close(props.num); if (core.events.recoverEvents(core.status.event.interval)) { + hold.end(true); return; } else if (has(core.status.event.ui)) { core.status.boxAnimateObjs = []; // @ts-ignore core.ui._drawViewMaps(core.status.event.ui); + hold.end(true); } else hold.end(); } @@ -141,42 +145,44 @@ function checkScroll() { } // 按键控制 -gameKey.use(props.ui.symbol); -gameKey - .realize('@book_up', () => { - if (selected.value > 0) { - selected.value--; - } - checkScroll(); - }) - .realize('@book_down', () => { - if (selected.value < enemy.length - 1) { - selected.value++; - } - checkScroll(); - }) - .realize('@book_pageDown', () => { - if (selected.value <= 4) { - selected.value = 0; - } else { - selected.value -= 5; - } - checkScroll(); - }) - .realize('@book_pageUp', () => { - if (selected.value >= enemy.length - 5) { - selected.value = enemy.length - 1; - } else { - selected.value += 5; - } - checkScroll(); - }) - .realize('exit', () => { - exit(); - }) - .realize('confirm', () => { - select(toShow[selected.value], selected.value); - }); +setTimeout(() => { + gameKey.use(props.ui.symbol); + gameKey + .realize('@book_up', () => { + if (selected.value > 0) { + selected.value--; + } + checkScroll(); + }) + .realize('@book_down', () => { + if (selected.value < enemy.length - 1) { + selected.value++; + } + checkScroll(); + }) + .realize('@book_pageDown', () => { + if (selected.value <= 4) { + selected.value = 0; + } else { + selected.value -= 5; + } + checkScroll(); + }) + .realize('@book_pageUp', () => { + if (selected.value >= enemy.length - 5) { + selected.value = enemy.length - 1; + } else { + selected.value += 5; + } + checkScroll(); + }) + .realize('exit', () => { + exit(); + }) + .realize('confirm', () => { + select(toShow[selected.value], selected.value); + }); +}, 0); onUnmounted(() => { gameKey.dispose(props.ui.symbol); diff --git a/src/ui/bookDetail.vue b/src/ui/bookDetail.vue index e84076b..19d5569 100644 --- a/src/ui/bookDetail.vue +++ b/src/ui/bookDetail.vue @@ -219,7 +219,7 @@ onUnmounted(() => { font-size: 4vw; bottom: 5%; left: 5vw; - width: 90vw; + width: 80vw; } } diff --git a/src/ui/toolbox.vue b/src/ui/toolbox.vue index bd5d27e..f0628ed 100644 --- a/src/ui/toolbox.vue +++ b/src/ui/toolbox.vue @@ -182,7 +182,7 @@ function use(id: ShowItemIds) { const hold = mainUi.holdOn(); exit(); nextTick(() => { - core.useItem(id, false, () => { + core.tryUseItem(id, false, () => { if (mainUi.stack.length === 0) { hold.end(core.status.event.id !== 'toolbox'); }