heriui载入 还有问题 - 移除了大量冗余节点和组件,减小预制体体积 - 调整部分节点名称和层级结构,更加清晰易维护 - 优化部分节点位置和尺寸属性,提升界面表现一致性 - 更新部分精灵资源引用及颜色配置,保证视觉效果正确 - 删除无用的动画剪辑和挂载组件,提升加载性能 - 重新整理属性覆盖信息,保持配置整洁规范
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { _decorator, Animation, AnimationClip, CCInteger, Component, instantiate, Label, Node, Prefab, resources, v3 } from 'cc';
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
import { HeroInfo } from '../common/config/heroSet';
|
|
import { GameEvent } from '../common/config/GameEvent';
|
|
import { oops } from 'db://oops-framework/core/Oops';
|
|
import { UIID } from '../common/config/GameUIConfig';
|
|
import { GameSet } from '../common/config/BoxSet';
|
|
import { finishCurrGuide } from '../common/config/Guide';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('HeroReadyCom')
|
|
export class HeroReadyCom extends Component {
|
|
@property(CCInteger)
|
|
slot: number=0;
|
|
@property(Prefab)
|
|
hero_prefab: Prefab = null!;
|
|
protected onLoad(): void {
|
|
|
|
}
|
|
start() {
|
|
this.add_heros()
|
|
}
|
|
update(deltaTime: number) {
|
|
|
|
}
|
|
add_heros(){
|
|
let heros=smc.heros
|
|
let x=0
|
|
for(let key in heros){
|
|
this.add_hero(heros[key].uuid,x)
|
|
console.log("[HeroReadyCom]:add_hero",heros[key],x)
|
|
x++
|
|
}
|
|
}
|
|
add_hero(hero:any,pos:number){
|
|
let hero_data = HeroInfo[hero]
|
|
if(!this.hero_prefab) return
|
|
const node = instantiate(this.hero_prefab) as unknown as Node;
|
|
let anm_path=hero_data.path
|
|
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
|
|
node.getChildByName("hero").getComponent(Animation).addClip(clip);
|
|
node.getChildByName("hero").getComponent(Animation).play("idle");
|
|
});
|
|
node.parent = this.node;
|
|
node.setPosition(v3(-pos*100,0,0))
|
|
}
|
|
|
|
reset() {
|
|
this.node.destroy()
|
|
}
|
|
|
|
}
|
|
|
|
|