继续完善,todo herocard 点击后显示信息

This commit is contained in:
2024-12-02 16:46:31 +08:00
parent 69ec6c93fc
commit 31b181eb87
10 changed files with 530 additions and 1879 deletions

View File

@@ -1,17 +1,8 @@
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,UITransform,v3 } from "cc";
import { _decorator,Button,EventHandler,EventTouch,instantiate,Label,NodeEventType,Prefab,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";
import { HeroList } from "../common/config/heroSet";
import { HeroCard } from "../hero/HeroCard";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -23,35 +14,26 @@ export class HeroHomeComp extends CCComp {
}
start() {
// this.load_talents()
console.log("hero_home start")
this.loads()
}
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; // 更新位置
}
loads(){
let heros:any=HeroList
let hc:number =HeroList.length
console.log("hero_home heros:",heros,hc)
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
parent.getComponent(UITransform).width=hc*150
console.log("parent:",parent)
for (let i = 0; i < hc; i++) {
let hcc =ecs.getEntity<HeroCard>(HeroCard)
hcc.load(HeroList[i],parent)
}
let hero_talent_content=parent.getComponent(UITransform)
hero_talent_content.height=2000
console.log("hero_talent_content:",parent)
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
hero_show(uuid:number) {
console.log("hero_home hero_show:",uuid)
}
reset() {
this.node.destroy();
}