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() }