角色视图 数据逻辑 依ecs 框架进行重构
This commit is contained in:
@@ -4,6 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { ItalConf, TalType, TalEType, talConf } from "../common/config/TalSet";
|
||||
import { BuffConf, SkillSet } from "../common/config/SkillSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
@@ -35,7 +37,7 @@ interface TalEffect {
|
||||
*/
|
||||
@ccclass('TalComp')
|
||||
@ecs.register('TalComp', false)
|
||||
export class TalComp extends CCComp {
|
||||
export class TalComp extends ecs.Comp {
|
||||
/** 英雄视图组件引用,运行时获取避免循环引用 */
|
||||
private heroView: any = null;
|
||||
private skillCon:any=null;
|
||||
@@ -57,8 +59,8 @@ export class TalComp extends CCComp {
|
||||
*/
|
||||
start() {
|
||||
// 运行时获取组件,避免编译时循环引用
|
||||
this.heroView = this.node.getComponent("HeroViewComp" as any);
|
||||
this.skillCon = this.node.getComponent("SkillConComp" as any);
|
||||
this.heroView = this.ent.get(HeroViewComp);
|
||||
this.skillCon = this.ent.get(SkillConComp);
|
||||
if (this.heroView) {
|
||||
this.heroUuid = this.heroView.hero_uuid;
|
||||
this.initializeTalents();
|
||||
@@ -165,6 +167,5 @@ export class TalComp extends CCComp {
|
||||
|
||||
reset() {
|
||||
this.isInitialized = false;
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user