物品ui修改 完善
This commit is contained in:
@@ -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});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { SkillSet } from "../common/config/SkillSet";
|
||||
import { HeroInfo, HeroSet } from "../common/config/heroSet";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { HChipComp } from "../hero/HChipComp";
|
||||
import { ItemComp } from "./ItemComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -23,31 +24,9 @@ export class ItemInfoComp extends CCComp {
|
||||
this.node.getChildByName("item").active = true;
|
||||
this.node.getChildByName("name").getComponent(Label).string=Items[args.uuid].name
|
||||
this.node.getChildByName("info").getComponent(Label).string=Items[args.uuid].info
|
||||
let url = "gui/items";
|
||||
let pathName= Items[args.uuid].path;
|
||||
this.node.getChildByName("item").getChildByName("lv1").active = false;
|
||||
this.node.getChildByName("item").getChildByName("lv2").active = false;
|
||||
this.node.getChildByName("item").getChildByName("lv3").active = false;
|
||||
this.node.getChildByName("item").getChildByName("lv4").active = false;
|
||||
|
||||
switch(Items[args.uuid].lv){
|
||||
case 1:
|
||||
this.node.getChildByName("item").getChildByName("lv1").active = true;
|
||||
break;
|
||||
case 2:
|
||||
this.node.getChildByName("item").getChildByName("lv2").active = true;
|
||||
break;
|
||||
case 3:
|
||||
this.node.getChildByName("item").getChildByName("lv3").active = true;
|
||||
break;
|
||||
case 4:
|
||||
this.node.getChildByName("item").getChildByName("lv4").active = true;
|
||||
break;
|
||||
}
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("item").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
let itemcom = this.node.getChildByName("item").getComponent(ItemComp);
|
||||
itemcom.update_data(args.uuid,args.num);
|
||||
}
|
||||
if(args.type==1){ //技能碎片
|
||||
this.node.getChildByName("skill").active = true;
|
||||
@@ -59,13 +38,12 @@ export class ItemInfoComp extends CCComp {
|
||||
// console.log("update_data",atlas,sprite)
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[args.uuid].path);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(args.type==2){ //英雄碎片
|
||||
this.node.getChildByName("hero").active = true;
|
||||
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片"
|
||||
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于英雄升阶,开宝箱获得"
|
||||
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于强化英雄,怪物掉落和开宝箱抽卡获得"
|
||||
let HChip=this.node.getChildByName("hero").getComponent(HChipComp);
|
||||
HChip.update_data(args.uuid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user