This commit is contained in:
walkpan
2024-09-29 08:06:30 +08:00
parent 2a88532ef4
commit 331b22da07
31 changed files with 5067 additions and 7357 deletions

View File

@@ -10,6 +10,8 @@ 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;
/** 视图层对象 */
@@ -21,12 +23,34 @@ export class HeroHomeComp extends CCComp {
}
start() {
let hero_talent_content=this.node.getChildByName("hero_talent").getChildByName("view").getChildByName("content").getComponent(UITransform)
hero_talent_content.height=2000
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();