58 lines
2.3 KiB
TypeScript
58 lines
2.3 KiB
TypeScript
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 { SkillSet } from "../common/config/SkillSet";
|
|
import { HeroModelComp } from "../hero/HeroModelComp";
|
|
import { RewardSet } from "../common/config/RewardSet";
|
|
import { GameSet } from "../common/config/BoxSet";
|
|
import { GameMap } from "./GameMap";
|
|
import { MapModelComp } from "./model/MapModelComp";
|
|
import { Talent } from "../Role/Talent";
|
|
import { Talents } from "../common/config/TalentSet";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/** 视图层对象 */
|
|
@ccclass('HeroHomeComp')
|
|
@ecs.register('HeroHome', false)
|
|
export class HeroHomeComp extends CCComp {
|
|
|
|
protected onLoad(): void {
|
|
|
|
}
|
|
start() {
|
|
|
|
this.load_talents()
|
|
console.log("hero_home start")
|
|
|
|
}
|
|
load_talents(){
|
|
let y=-70
|
|
let pos = v3(0,y)
|
|
let talents:any= Talents
|
|
let parent= this.node.getChildByName("talents").getChildByName("view").getChildByName("content")
|
|
console.log("talents:",talents,)
|
|
const keys = Object.keys(talents);
|
|
if (keys.length === 0) {
|
|
console.log("No talents to process.");
|
|
} else {
|
|
for (const key of keys) {
|
|
const talentData = talents[key];
|
|
let talent = ecs.getEntity<Talent>(Talent);
|
|
console.log("talent:", talentData);
|
|
let uuid = talentData.uuid;
|
|
talent.load(pos, uuid, parent);
|
|
pos.y -= 140; // 更新位置
|
|
}
|
|
}
|
|
let hero_talent_content=parent.getComponent(UITransform)
|
|
hero_talent_content.height=2000
|
|
console.log("hero_talent_content:",parent)
|
|
}
|
|
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
reset() {
|
|
this.node.destroy();
|
|
}
|
|
} |