技能碎片完成
This commit is contained in:
35
assets/script/game/hero/SChipComp.ts
Normal file
35
assets/script/game/hero/SChipComp.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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){
|
||||
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);
|
||||
});
|
||||
if(num > 0){
|
||||
this.node.getChildByName("num").getComponent(Label).string = num.toString();
|
||||
}else{
|
||||
this.node.getChildByName("num").getComponent(Label).string = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user