继续完善,todo herocard 点击后显示信息
This commit is contained in:
37
assets/script/game/hero/HeroCardComp.ts
Normal file
37
assets/script/game/hero/HeroCardComp.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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 { HeroHomeComp } from "../map/HeroHomeComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HeroCardComp')
|
||||
@ecs.register('HeroCardComp', false)
|
||||
export class HeroCardComp extends CCComp {
|
||||
@property(HeroHomeComp)
|
||||
hcc_home: HeroHomeComp = null!;
|
||||
hcc_uuid: number = 0;
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
this.hcc_home=this.node.parent.parent.parent.parent.getComponent(HeroHomeComp);
|
||||
// console.log("hero_card hcc_home",this.hcc_home)
|
||||
|
||||
}
|
||||
show_info(){
|
||||
this.hcc_home.hero_show(this.hcc_uuid)
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user