From c3024caef4ccc7f00a1922db9682123ed965e8ba Mon Sep 17 00:00:00 2001 From: walkpan Date: Tue, 24 Mar 2026 22:24:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E5=86=85?= =?UTF-8?q?=E5=AD=98=E9=9D=A2=E6=9D=BF=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8E=A7=E5=88=B6=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 MissionComp 的 onLoad 方法中初始化 showMemoryPanel 为 false,并调用 removeMemoryPanel 来销毁内存面板节点。 同时,将 update 方法中对 updateMemoryPanel 的调用移除,以停止面板的持续更新。 --- assets/script/game/map/MissionComp.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 8e0a9d9c..da4ef3aa 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -77,12 +77,13 @@ export class MissionComp extends CCComp { // 记录已触发的特殊刷怪索引 onLoad(){ + this.showMemoryPanel = false this.on(GameEvent.MissionStart,this.mission_start,this) // this.on(GameEvent.HeroDead,this.do_hero_dead,this) // this.on(GameEvent.FightEnd,this.fight_end,this) this.on(GameEvent.MissionEnd,this.mission_end,this) this.on(GameEvent.DO_AD_BACK,this.do_ad,this) - this.initMemoryPanel() + this.removeMemoryPanel() } protected update(dt: number): void { if(!smc.mission.play) return @@ -94,7 +95,6 @@ export class MissionComp extends CCComp { this.FightTime-=dt // 检查特殊刷怪时间 this.update_time(); - this.updateMemoryPanel(dt); } } update_time(){ @@ -331,6 +331,15 @@ export class MissionComp extends CCComp { this.memoryLabel = label; } + private removeMemoryPanel() { + const panel = this.time_node?.getChildByName("mem_panel"); + if (panel) { + panel.destroy(); + } + this.memoryLabel = null; + this.lastMemoryText = ""; + } + private updateMemoryPanel(dt: number) { if (!this.showMemoryPanel || !this.memoryLabel) return;