开箱 重做完成, item 信息更新修改
This commit is contained in:
@@ -17,6 +17,34 @@ export class ItemComp extends CCComp {
|
||||
//todo 设定icon 显示
|
||||
}
|
||||
|
||||
update_data(uuid:number,num:number){
|
||||
this.i_uuid=uuid;
|
||||
this.num=num;
|
||||
this.node.getChildByName("num").getComponent(Label).string = num.toString();
|
||||
if(num==0){
|
||||
this.node.getChildByName("num").getComponent(Label).string ="";
|
||||
}
|
||||
let url = "gui/items";
|
||||
let pathName= Items[uuid].path;
|
||||
switch(Items[uuid].lv){
|
||||
case 1:
|
||||
this.node.getChildByName("lv1").active = true;
|
||||
break;
|
||||
case 2:
|
||||
this.node.getChildByName("lv2").active = true;
|
||||
break;
|
||||
case 3:
|
||||
this.node.getChildByName("lv3").active = true;
|
||||
break;
|
||||
case 4:
|
||||
this.node.getChildByName("lv4").active = true;
|
||||
break;
|
||||
}
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
}
|
||||
show_info(){
|
||||
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user