import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc'; import { SkillSet } from '../common/config/SkillSet'; import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops'; import { UIID } from '../common/config/GameUIConfig'; import { Items } from '../common/config/Items'; 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) { } show_info(){ if(this.node.parent.name=="reward") return oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:1}); } update_data(uuid:number,num:number=0){ this.h_uuid = uuid; 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/heros/cards" // 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); }); } }