物品ui修改 完善

This commit is contained in:
2025-01-20 10:29:02 +08:00
parent d756516cc6
commit 2b7de7ee92
11 changed files with 2853 additions and 1237 deletions

View File

@@ -17,7 +17,7 @@ export class ItemComp extends CCComp {
//todo 设定icon 显示
}
update_data(uuid:number,num:number){
update_data(uuid:number,num:number=0){
this.i_uuid=uuid;
this.num=num;
this.node.getChildByName("num").getComponent(Label).string = num.toString();
@@ -26,26 +26,18 @@ export class ItemComp extends CCComp {
}
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;
}
this.node.getChildByName("lv1").active = Items[uuid].lv==1;
this.node.getChildByName("lv2").active = Items[uuid].lv==2;
this.node.getChildByName("lv3").active = Items[uuid].lv==3;
this.node.getChildByName("lv4").active = Items[uuid].lv==4;
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
}