Files
heros/assets/script/game/hero/SChipComp.ts

40 lines
1.1 KiB
TypeScript

import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { HeroInfo } from '../common/config/heroSet';
import { SkillSet } from '../common/config/SkillSet';
const { ccclass, property } = _decorator;
@ccclass('SChipComp')
export class SChipComp extends Component {
h_uuid:number=0
num:number=0
lv:number=0
start() {
}
update(deltaTime: number) {
}
update_data(uuid:number,num:number=0){
if(num > 0){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
}
if(uuid == 0){ return;}
var icon_path = "game/skills/skill_icon"
// console.log("update_data",SkillSet[uuid].path)
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("skill").getChildByName("icon").getComponent(Sprite);
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
}
}