From 93e0ab083be8c24f035d8695a7d08dbfc97374ff Mon Sep 17 00:00:00 2001 From: walkpan Date: Mon, 5 Jan 2026 19:31:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=8B=B1=E9=9B=84=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=99=E4=BC=B4=E5=8F=AC=E5=94=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=92=8C=E5=8F=AF=E9=80=89=E6=8B=A9=E7=9A=84=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E4=B8=8E=E6=8A=80=E8=83=BD=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在SkillSet和heroSet中分别添加CanSelectSkills和CanSelectHeros常量 - 修改MissionHeroComp使用oops.message管理CallFriend事件 - 在MissionCardComp中新增Partner卡牌类型,支持召唤伙伴功能 - 完善事件处理逻辑,添加对应的事件监听和销毁 --- assets/script/game/common/config/SkillSet.ts | 2 ++ assets/script/game/common/config/heroSet.ts | 2 ++ assets/script/game/map/MissionCardComp.ts | 24 +++++++++++++++++--- assets/script/game/map/MissionHeroComp.ts | 9 +++++++- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 8bbbe3f8..635f4da3 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -261,4 +261,6 @@ export const EAnmConf: Record = { 9001:{uuid:9001,path:"atked",loop:false,time:0}, }; +export const CanSelectSkills = [6001, 6002, 6005, 6100, 6101, 6102, 6103]; + diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 628da0f3..e8e55f5f 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -121,6 +121,8 @@ export interface heroInfo { info: string; // 描述文案 } +export const CanSelectHeros = [5001, 5002, 5005, 5007, 5008, 5009, 5010]; + export const HeroInfo: Record = { // ========== 英雄角色 ========== diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 5c4dfe85..b24e0204 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -4,7 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { GameEvent } from "../common/config/GameEvent"; import { talConf, ItalConf } from "../common/config/TalSet"; -import { SkillSet } from "../common/config/SkillSet"; +import { CanSelectHeros, HeroInfo } from "../common/config/heroSet"; +import { CanSelectSkills, SkillSet } from "../common/config/SkillSet"; import { ItemSet } from "../common/config/ItemSet"; import { smc } from "../common/SingletonModuleComp"; @@ -13,7 +14,8 @@ const { ccclass, property } = _decorator; export enum CardType { Talent = 1, Skill = 2, - Potion = 3 + Potion = 3, + Partner = 4 } /** 视图层对象 */ @@ -52,6 +54,7 @@ export class MissionCardComp extends CCComp { oops.message.on(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this); oops.message.on(GameEvent.ShopOpen, this.onShopOpen, this); oops.message.on(GameEvent.MissionStart, this.init, this); + oops.message.on(GameEvent.ToCallFriend, this.onCallFriend, this); } @@ -59,6 +62,9 @@ export class MissionCardComp extends CCComp { oops.message.off(GameEvent.TalentSelect, this.onTalentSelect, this); oops.message.off(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this); oops.message.off(GameEvent.ShopOpen, this.onShopOpen, this); + oops.message.off(GameEvent.MissionStart, this.init, this); + oops.message.off(GameEvent.ToCallFriend, this.onCallFriend, this); + this.ent.destroy(); } init(){ @@ -107,6 +113,11 @@ export class MissionCardComp extends CCComp { this.checkQueue(); } + private onCallFriend(event: string, args: any) { + this.eventQueue.push(CardType.Partner); + this.checkQueue(); + } + private checkQueue() { if (this.node.active) return; if (this.eventQueue.length === 0) return; @@ -147,7 +158,10 @@ export class MissionCardComp extends CCComp { allData = Object.values(talConf); } else if (this.curCardType === CardType.Skill) { // 过滤掉怪物技能 (uuid >= 6200) - allData = Object.values(SkillSet).filter((s:any) => s.uuid < 6200); + // allData = Object.values(SkillSet).filter((s:any) => s.uuid < 6200); + allData = CanSelectSkills.map(id => SkillSet[id]); + } else if (this.curCardType === CardType.Partner) { + allData = CanSelectHeros.map(id => HeroInfo[id]); } // 后续扩展其他类型 // else if (this.curCardType === CardType.Skill) { ... } @@ -188,6 +202,8 @@ export class MissionCardComp extends CCComp { desc = data.desc || ""; } else if (this.curCardType === CardType.Skill) { desc = data.info || ""; + } else if (this.curCardType === CardType.Partner) { + desc = data.info || ""; } else { desc = data.desc || ""; } @@ -290,6 +306,8 @@ export class MissionCardComp extends CCComp { } else if (this.curCardType === CardType.Skill) { smc.addSkillRecord(selectedData.uuid); oops.message.dispatchEvent(GameEvent.UseSkillCard, selectedData.uuid); + } else if (this.curCardType === CardType.Partner) { + oops.message.dispatchEvent(GameEvent.CallFriend, { uuid: selectedData.uuid }); } // 后续扩展其他类型事件 this.node.active = false; diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index c06137ff..55ddc6b4 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -6,6 +6,7 @@ import { smc } from "../common/SingletonModuleComp"; import { Timer } from "db://oops-framework/core/common/timer/Timer"; import { GameEvent } from "../common/config/GameEvent"; import { HeroPos } from "../common/config/heroSet"; +import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; const { ccclass, property } = _decorator; /** 视图层对象 */ @@ -21,8 +22,14 @@ export class MissionHeroCompComp extends CCComp { this.on(GameEvent.FightReady,this.fight_ready,this) this.on(GameEvent.Zhaohuan,this.zhao_huan,this) this.on(GameEvent.MissionEnd,this.clear_heros,this) - this.on(GameEvent.CallFriend,this.call_friend,this) + // this.on(GameEvent.CallFriend,this.call_friend,this) + oops.message.on(GameEvent.CallFriend,this.call_friend,this) } + + onDestroy(){ + oops.message.off(GameEvent.CallFriend,this.call_friend,this) + } + start() { // this.test_call() }