From 8fa54e894ada9ca769a040aae021d4a0998bf874 Mon Sep 17 00:00:00 2001 From: panFD Date: Thu, 30 Jul 2026 17:18:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(mission):=20=E4=BF=AE=E5=A4=8D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=9F=B3=E5=88=9D=E5=A7=8B=E5=8C=96=E5=92=8C=E6=8A=BD?= =?UTF-8?q?=E5=8D=A1UI=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 初始化任务时手动派发刷新石数量变更事件,解决MissionStart早于data_init导致的UI未刷新问题 2. 抽卡按钮置灰和费用显示逻辑抽离为统一的updateDrawCostUI方法,简化重复代码 --- assets/script/game/map/MissionCardComp.ts | 17 ++++------------- assets/script/game/map/MissionComp.ts | 3 ++- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 20d87e19..f082ea49 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -1481,12 +1481,8 @@ export class MissionCardComp extends CCComp { if (this.showHeros && this.showHeros.isValid) { this.showHeros.active = true; } - if (this.cards_chou && this.cards_chou.isValid) { - const nobg = this.cards_chou.getChildByName("nobg"); - if (nobg) { - nobg.active = !this.canDrawCards(); - } - } + // 刷新所有刷新按钮的费用显示(含刷新石/金币切换与置灰状态) + this.updateDrawCostUI(); // 显示卡牌面板(默认进入准备阶段时展开) if (this.cardPanNode && this.cardPanNode.isValid) { this.cardPanNode.active = true; @@ -1518,13 +1514,8 @@ export class MissionCardComp extends CCComp { private enterBattlePhase() { if (!this.cards_node || !this.cards_node.isValid) return; this.initCardsPanelPos(); - // 战斗阶段允许抽卡:nobg 按"金币是否足够"判断 - if (this.cards_chou && this.cards_chou.isValid) { - const nobg = this.cards_chou.getChildByName("nobg"); - if (nobg) { - nobg.active = !this.canDrawCards(); - } - } + // 战斗阶段允许抽卡:刷新所有刷新按钮的费用显示(含刷新石/金币切换与置灰状态) + this.updateDrawCostUI(); } /** diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index aed2f9ba..fd9c23e6 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -801,8 +801,9 @@ export class MissionComp extends CCComp { smc.resetScores(); smc.vmdata.mission_data.coin = Math.max(0, Math.floor(FightSet.INIT_COIN)); - // 初始化刷新石数量 + // 初始化刷新石数量,并派发事件通知 UI 刷新(MissionStart 早于 data_init,需手动通知) smc.vmdata.mission_data.refresh_stone = Math.max(0, Math.floor(FightSet.INIT_REFRESH_STONE)); + oops.message.dispatchEvent(GameEvent.RefreshStone, { delta: FightSet.INIT_REFRESH_STONE }); // 【评分系统 - 效率分】记录初始获得的金币收入 smc.vmdata.scores.gold_earned += smc.vmdata.mission_data.coin; }