英雄卡片 召唤成功, todo 细节优化
This commit is contained in:
31
assets/script/game/map/HCardComp.ts
Normal file
31
assets/script/game/map/HCardComp.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,UITransform,v3 } 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 { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HCardComp')
|
||||
@ecs.register('HCardComp', false)
|
||||
export class HCardComp extends CCComp {
|
||||
hi: number = 0;
|
||||
|
||||
protected onLoad(): void {
|
||||
|
||||
|
||||
}
|
||||
start() {
|
||||
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
|
||||
this.node.getChildByName("name").getComponent(Label)!.string = heros[this.hi].HeroView.hero_name
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
console.log("hcard reset");
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user