45 lines
2.2 KiB
TypeScript
45 lines
2.2 KiB
TypeScript
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc';
|
|
import { HeroInfo, HQuality } from '../common/config/heroSet';
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('HCardUICom')
|
|
export class HCardUICom extends Component {
|
|
h_uuid:number=0
|
|
start() {
|
|
console.log("[HCardUICom]:start")
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
|
|
}
|
|
update_data(uuid:number){
|
|
console.log("[HCardUICom]:update_data",uuid)
|
|
this.h_uuid=uuid
|
|
let hero_data = HeroInfo[uuid]
|
|
let hero= this.node.getChildByName("hero")
|
|
let anm_path=hero_data.path
|
|
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
|
|
hero.getComponent(Animation).addClip(clip);
|
|
hero.getComponent(Animation).play("idle");
|
|
});
|
|
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
|
|
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString()
|
|
this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1
|
|
this.node.getChildByName("slv").getChildByName("lv2").active=smc.heros[uuid].slv>=2
|
|
this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
|
|
this.node.getChildByName("slv").getChildByName("lv4").active=smc.heros[uuid].slv>=4
|
|
this.node.getChildByName("slv").getChildByName("lv5").active=smc.heros[uuid].slv>=5
|
|
this.node.getChildByName("g").active=hero_data.quality==HQuality.GREEN
|
|
this.node.getChildByName("gg").active=hero_data.quality==HQuality.GREEN
|
|
this.node.getChildByName("b").active=hero_data.quality==HQuality.BLUE
|
|
this.node.getChildByName("bg").active=hero_data.quality==HQuality.BLUE
|
|
this.node.getChildByName("p").active=hero_data.quality==HQuality.PURPLE
|
|
this.node.getChildByName("pg").active=hero_data.quality==HQuality.PURPLE
|
|
this.node.getChildByName("y").active=hero_data.quality==HQuality.ORANGE
|
|
this.node.getChildByName("yg").active=hero_data.quality==HQuality.ORANGE
|
|
}
|
|
}
|
|
|
|
|