From c183ae464a4b48dfe642be832e6cd3c76a421a78 Mon Sep 17 00:00:00 2001 From: pan Date: Sun, 20 Sep 2026 14:15:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(HerosListComp):=20=E8=A1=A5=E5=88=B7?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E5=8D=87=E7=BA=A7=E7=BA=A2=E7=82=B9=E5=9C=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=96=B0=E6=98=BE=E7=A4=BA=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 页面隐藏期间会错过HERO_GROWTH_UPDATE事件,重新显示时补刷所有卡片的可升级状态,首次onEnable早于start时遍历空数组无风险 --- assets/script/game/map/HerosListComp.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/script/game/map/HerosListComp.ts b/assets/script/game/map/HerosListComp.ts index b81918c9..ca3b81f7 100644 --- a/assets/script/game/map/HerosListComp.ts +++ b/assets/script/game/map/HerosListComp.ts @@ -79,6 +79,9 @@ export class HerosListComp extends CCComp { protected onEnable(): void { oops.message.on(GameEvent.HERO_GROWTH_UPDATE, this.onGrowthUpdate, this) + // 页面隐藏期间会错过事件(战斗结算发碎片时本节点 active=false 已注销监听), + // 重新显示时必须补刷;首次 onEnable 早于 start,卡片未创建时 forEach 空数组安全 + this.refreshAllCardsCanUp() } protected onDisable(): void {