英雄页面ui 继续完善

This commit is contained in:
2024-12-23 10:52:59 +08:00
parent 26c673e95b
commit ee830b3ed2
4 changed files with 3975 additions and 2885 deletions

View File

@@ -46,26 +46,35 @@ export class HeroHomeComp extends CCComp {
this.hero=HeroInfo[uuid]
let tal=this.node.getChildByName("sk").getChildByName("tal");
let sk_node= this.node.getChildByName("sk");
let skill = SkillSet[this.hero.sk2[0]]
let skill1 = SkillSet[this.hero.sk1[0]]
let skill2 = SkillSet[this.hero.sk2[0]]
var sk_path = "game/skills/skill_icon"
var icon_path = "game/heros/herois"
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(this.hero.path);
});
resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
const sprite = sk_node.getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill.path);
const sprite = this.node.getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill1.path);
});
sk_node.getChildByName("name").getComponent(Label).string = skill.name;
sk_node.getChildByName("info").getComponent(Label).string = skill.info;
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0]
tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1]
tal.getChildByName("slv3").getChildByName("val").getComponent(Label).string = this.hero.tals[2]
tal.getChildByName("slv4").getChildByName("val").getComponent(Label).string = this.hero.tals[3]
tal.getChildByName("slv5").getChildByName("val").getComponent(Label).string = this.hero.tals[4]
this.node.getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
this.node.getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill2.path);
});
this.node.getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
this.node.getChildByName("sk2").getChildByName("info").getComponent(Label).string = skill2.info;
// tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0]
// tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1]
// tal.getChildByName("slv3").getChildByName("val").getComponent(Label).string = this.hero.tals[2]
// tal.getChildByName("slv4").getChildByName("val").getComponent(Label).string = this.hero.tals[3]
// tal.getChildByName("slv5").getChildByName("val").getComponent(Label).string = this.hero.tals[4]
this.update_data()
}
update_data(){
@@ -87,6 +96,7 @@ export class HeroHomeComp extends CCComp {
lvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.ap_up
lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_up
lvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.hp_up
lvup.getChildByName("item").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/((LvUp[0]+this.hero.lvexp)*this.role.lv)
// slvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*(this.role.slv+1)).toString()
slvup.getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv)).toString()
@@ -175,11 +185,11 @@ export class HeroHomeComp extends CCComp {
}
slv_up(){
if(this.role.slv>=5){
oops.gui.toast("已经满星,升失败");
oops.gui.toast("已经满星,升失败");
return
}
if(smc.heros[this.h_uuid].num < ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))){
oops.gui.toast("资源不足,升失败");
oops.gui.toast("资源不足,升失败");
return
}
smc.heros[this.h_uuid].num -= SlvUp[this.role.slv]*(1+this.role.slv)