From 4630667a548b2349fe3fe5bb71a7e8b7719b1ee4 Mon Sep 17 00:00:00 2001 From: panw Date: Fri, 30 Jan 2026 15:34:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BA=8B=E4=BB=B6=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=85=B3=E5=8D=A1=E5=A5=96=E5=8A=B1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 GameEvent 枚举中添加 AttrSelect 事件 - 修改 MissionComp.call_cards 方法,默认每级都触发属性选择事件 - 移除药水奖励类型对应的事件分发,将其注释保留 - 在 MissionCardComp 中注册并处理 AttrSelect 事件,将其加入事件队列 --- assets/script/game/common/config/GameEvent.ts | 1 + assets/script/game/map/MissionCardComp.ts | 7 +++++++ assets/script/game/map/MissionComp.ts | 14 +++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/assets/script/game/common/config/GameEvent.ts b/assets/script/game/common/config/GameEvent.ts index eb0d0de6..133f4353 100644 --- a/assets/script/game/common/config/GameEvent.ts +++ b/assets/script/game/common/config/GameEvent.ts @@ -50,6 +50,7 @@ export enum GameEvent { UseTalentCard = "UseTalentCard", UseItemCard = "UseItemCard", UseAttrCard = "UseAttrCard", + AttrSelect = "AttrSelect", NewWave = "NewWave", AD_BACK_TRUE = "AD_BACK_TRUE", AD_BACK_FALSE = "AD_BACK_FALSE", diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index fa417ab3..f5169bef 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -60,6 +60,7 @@ export class MissionCardComp extends CCComp { } oops.message.on(GameEvent.TalentSelect, this.onTalentSelect, this); + oops.message.on(GameEvent.AttrSelect, this.onAttrSelect, this); oops.message.on(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this); oops.message.on(GameEvent.ShopOpen, this.onShopOpen, this); oops.message.on(GameEvent.MissionStart, this.onMissionStart, this); @@ -74,6 +75,7 @@ export class MissionCardComp extends CCComp { } oops.message.off(GameEvent.TalentSelect, this.onTalentSelect, this); + oops.message.off(GameEvent.AttrSelect, this.onAttrSelect, this); oops.message.off(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this); oops.message.off(GameEvent.ShopOpen, this.onShopOpen, this); oops.message.off(GameEvent.MissionStart, this.onMissionStart, this); @@ -143,6 +145,11 @@ export class MissionCardComp extends CCComp { this.checkQueue(); } + private onAttrSelect(event: string, args: any) { + this.eventQueue.push({ type: CardType.Attr }); + this.checkQueue(); + } + private onTalentSelect(event: string, args: any) { this.eventQueue.push({ type: CardType.Talent }); this.checkQueue(); diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index eeea9172..5ac4d494 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -74,8 +74,12 @@ export class MissionComp extends CCComp { } call_cards(lv:number){ const rewardType = getLevelRewardType(lv); + console.log(`[MissionComp] 触发奖励选择, 类型: ${rewardType}`); + // 默认每级都触发属性选择 + oops.message.dispatchEvent(GameEvent.AttrSelect); + // 根据类型发送对应的事件 switch (rewardType) { case CardType.Talent: @@ -87,13 +91,9 @@ export class MissionComp extends CCComp { case CardType.Partner: oops.message.dispatchEvent(GameEvent.ToCallFriend); break; - case CardType.Potion: - oops.message.dispatchEvent(GameEvent.ShopOpen); - break; - default: - console.warn(`[MissionComp] 未知的奖励类型: ${rewardType}`); - oops.message.dispatchEvent(GameEvent.TalentSelect); // 默认回退到天赋选择 - break; + // case CardType.Potion: + // oops.message.dispatchEvent(GameEvent.ShopOpen); + // break; } } showLevelUpReward() {