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

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

View File

@@ -15,35 +15,12 @@ export class Item extends ecs.Entity {
var path = "game/gui/item";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.getChildByName("num").getComponent(Label).string = num.toString();
if(num==0){
node.getChildByName("num").getComponent(Label).string ="";
}
let url = "gui/items";
let pathName= Items[uuid].path;
switch(Items[uuid].lv){
case 1:
node.getChildByName("lv1").active = true;
break;
case 2:
node.getChildByName("lv2").active = true;
break;
case 3:
node.getChildByName("lv3").active = true;
break;
case 4:
node.getChildByName("lv4").active = true;
break;
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
node.parent = praent
let iv = node.getComponent(ItemComp)!;
iv.i_uuid = uuid
iv.num=num
iv.update_data(uuid,num)
this.add(iv)
}
/** 模块资源释放 */