import { _decorator, Color, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc'; import { HeroInfo } from '../common/config/heroSet'; import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops'; import { UIID } from '../common/config/GameUIConfig'; import { Items } from '../common/config/Items'; import { ColorSet } from '../common/config/BoxSet'; const { ccclass, property } = _decorator; @ccclass('HChipComp') export class HChipComp extends Component { h_uuid:number=0 num:number=0 lv:number=0 start() { } update(deltaTime: number) { } show_info(){ if(this.node.parent.name=="item_info") return oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2}); } update_data(uuid:number,num:number=0){ this.h_uuid = uuid; var icon_path = "game/heros/herois" resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite); sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path); }); if(num > 1){ this.node.getChildByName("num").getComponent(Label).string = num.toString(); }else{ this.node.getChildByName("num").getComponent(Label).string = ""; } this.node.getChildByName("g1").active=HeroInfo[uuid].quality==1 this.node.getChildByName("g2").active=HeroInfo[uuid].quality==2 this.node.getChildByName("g3").active=HeroInfo[uuid].quality==3 } }