开箱 重做完成, item 信息更新修改

This commit is contained in:
2024-12-20 14:59:38 +08:00
parent 330f8da3da
commit e34eb5452b
6 changed files with 406 additions and 417 deletions

View File

@@ -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});
}