技能ui完成, todo 技能执行
This commit is contained in:
35
assets/script/game/map/SkillHomeComp.ts
Normal file
35
assets/script/game/map/SkillHomeComp.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { _decorator, UITransform } 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 { MSklist } from "../common/config/SkillSet";
|
||||
import { MSCard } from "./MSCard";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('SkillHomeComp')
|
||||
@ecs.register('SkillHome', false)
|
||||
export class SkillHomeComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
this.load_skill_card()
|
||||
}
|
||||
|
||||
load_skill_card(){
|
||||
let ms_num:number =MSklist.length
|
||||
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
|
||||
let height=ms_num*135
|
||||
parent.getComponent(UITransform).width=height
|
||||
for (let i = 0; i < ms_num; i++) {
|
||||
let msc =ecs.getEntity<MSCard>(MSCard)
|
||||
msc.load(MSklist[i],parent,1)
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user