import { _decorator } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { oops } from "db://oops-framework/core/Oops"; import { GameEvent } from "../common/config/GameEvent"; import { EquipAttrTarget, EquipInfo } from "../common/config/Equips"; import { HeroViewComp } from "./HeroViewComp"; import { BuffAttr } from "../common/config/SkillSet"; import { EnhancementType } from "../common/config/LevelUp"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('HeroConComp') @ecs.register('HeroCon') export class HeroConComp extends CCComp { /** 视图层逻辑代码分离演示 */ heroView:HeroViewComp=null protected onLoad(): void { this.on(GameEvent.EquipAdd,this.equip_add,this) this.on(GameEvent.EquipChange,this.equip_change,this) this.on(GameEvent.FightReady,this.fight_ready,this) this.on(GameEvent.UseSpecialCard,this.use_special_card,this) this.on(GameEvent.UseEnhancement,this.use_enhancement,this) this.on(GameEvent.UseTalentCard,this.use_talent_card,this) this.heroView=this.node.getComponent(HeroViewComp) console.log("[HeroConCompComp]:onLoad",this.heroView) } start() { console.log("[HeroConCompComp]:start",this.heroView) // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // this.on(ModuleEvent.Cmd, this.onHandler, this); } equip_add(e:GameEvent,data:any){ console.log("[HeroConCompComp]:equip_add",data,this.heroView) let equip=EquipInfo[data.uuid] let buffs=equip.buff let special_attr=equip.special_attr for(let i=0;i