feat(英雄系统): 添加伙伴召唤功能和可选择的英雄与技能列表
- 在SkillSet和heroSet中分别添加CanSelectSkills和CanSelectHeros常量 - 修改MissionHeroComp使用oops.message管理CallFriend事件 - 在MissionCardComp中新增Partner卡牌类型,支持召唤伙伴功能 - 完善事件处理逻辑,添加对应的事件监听和销毁
This commit is contained in:
@@ -261,4 +261,6 @@ export const EAnmConf: Record<number, IEndAnm> = {
|
|||||||
9001:{uuid:9001,path:"atked",loop:false,time:0},
|
9001:{uuid:9001,path:"atked",loop:false,time:0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CanSelectSkills = [6001, 6002, 6005, 6100, 6101, 6102, 6103];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ export interface heroInfo {
|
|||||||
info: string; // 描述文案
|
info: string; // 描述文案
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CanSelectHeros = [5001, 5002, 5005, 5007, 5008, 5009, 5010];
|
||||||
|
|
||||||
export const HeroInfo: Record<number, heroInfo> = {
|
export const HeroInfo: Record<number, heroInfo> = {
|
||||||
// ========== 英雄角色 ==========
|
// ========== 英雄角色 ==========
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
|||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { talConf, ItalConf } from "../common/config/TalSet";
|
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 { ItemSet } from "../common/config/ItemSet";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
|
||||||
@@ -13,7 +14,8 @@ const { ccclass, property } = _decorator;
|
|||||||
export enum CardType {
|
export enum CardType {
|
||||||
Talent = 1,
|
Talent = 1,
|
||||||
Skill = 2,
|
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.HeroSkillSelect, this.onHeroSkillSelect, this);
|
||||||
oops.message.on(GameEvent.ShopOpen, this.onShopOpen, this);
|
oops.message.on(GameEvent.ShopOpen, this.onShopOpen, this);
|
||||||
oops.message.on(GameEvent.MissionStart, this.init, 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.TalentSelect, this.onTalentSelect, this);
|
||||||
oops.message.off(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this);
|
oops.message.off(GameEvent.HeroSkillSelect, this.onHeroSkillSelect, this);
|
||||||
oops.message.off(GameEvent.ShopOpen, this.onShopOpen, 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();
|
this.ent.destroy();
|
||||||
}
|
}
|
||||||
init(){
|
init(){
|
||||||
@@ -107,6 +113,11 @@ export class MissionCardComp extends CCComp {
|
|||||||
this.checkQueue();
|
this.checkQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onCallFriend(event: string, args: any) {
|
||||||
|
this.eventQueue.push(CardType.Partner);
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
private checkQueue() {
|
private checkQueue() {
|
||||||
if (this.node.active) return;
|
if (this.node.active) return;
|
||||||
if (this.eventQueue.length === 0) return;
|
if (this.eventQueue.length === 0) return;
|
||||||
@@ -147,7 +158,10 @@ export class MissionCardComp extends CCComp {
|
|||||||
allData = Object.values(talConf);
|
allData = Object.values(talConf);
|
||||||
} else if (this.curCardType === CardType.Skill) {
|
} else if (this.curCardType === CardType.Skill) {
|
||||||
// 过滤掉怪物技能 (uuid >= 6200)
|
// 过滤掉怪物技能 (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) { ... }
|
// else if (this.curCardType === CardType.Skill) { ... }
|
||||||
@@ -188,6 +202,8 @@ export class MissionCardComp extends CCComp {
|
|||||||
desc = data.desc || "";
|
desc = data.desc || "";
|
||||||
} else if (this.curCardType === CardType.Skill) {
|
} else if (this.curCardType === CardType.Skill) {
|
||||||
desc = data.info || "";
|
desc = data.info || "";
|
||||||
|
} else if (this.curCardType === CardType.Partner) {
|
||||||
|
desc = data.info || "";
|
||||||
} else {
|
} else {
|
||||||
desc = data.desc || "";
|
desc = data.desc || "";
|
||||||
}
|
}
|
||||||
@@ -290,6 +306,8 @@ export class MissionCardComp extends CCComp {
|
|||||||
} else if (this.curCardType === CardType.Skill) {
|
} else if (this.curCardType === CardType.Skill) {
|
||||||
smc.addSkillRecord(selectedData.uuid);
|
smc.addSkillRecord(selectedData.uuid);
|
||||||
oops.message.dispatchEvent(GameEvent.UseSkillCard, 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;
|
this.node.active = false;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { smc } from "../common/SingletonModuleComp";
|
|||||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { HeroPos } from "../common/config/heroSet";
|
import { HeroPos } from "../common/config/heroSet";
|
||||||
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
/** 视图层对象 */
|
/** 视图层对象 */
|
||||||
@@ -21,8 +22,14 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||||
this.on(GameEvent.Zhaohuan,this.zhao_huan,this)
|
this.on(GameEvent.Zhaohuan,this.zhao_huan,this)
|
||||||
this.on(GameEvent.MissionEnd,this.clear_heros,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() {
|
start() {
|
||||||
// this.test_call()
|
// this.test_call()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user