英雄页面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

@@ -2385,7 +2385,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_string": "升", "_string": "升",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 25, "_actualFontSize": 25,

File diff suppressed because it is too large Load Diff

View File

@@ -46,26 +46,35 @@ export class HeroHomeComp extends CCComp {
this.hero=HeroInfo[uuid] this.hero=HeroInfo[uuid]
let tal=this.node.getChildByName("sk").getChildByName("tal"); let tal=this.node.getChildByName("sk").getChildByName("tal");
let sk_node= this.node.getChildByName("sk"); 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 sk_path = "game/skills/skill_icon"
var icon_path = "game/heros/herois" 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) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite); const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(this.hero.path); sprite.spriteFrame = atlas.getSpriteFrame(this.hero.path);
}); });
resources.load(sk_path, SpriteAtlas, (err: any, atlas) => { resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
const sprite = sk_node.getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite); const sprite = this.node.getChildByName("sk").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(skill.path); sprite.spriteFrame = atlas.getSpriteFrame(skill1.path);
}); });
sk_node.getChildByName("name").getComponent(Label).string = skill.name; this.node.getChildByName("sk").getChildByName("name").getComponent(Label).string = skill1.name;
sk_node.getChildByName("info").getComponent(Label).string = skill.info; this.node.getChildByName("sk").getChildByName("info").getComponent(Label).string = skill1.info;
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name resources.load(sk_path, SpriteAtlas, (err: any, atlas) => {
tal.getChildByName("slv1").getChildByName("val").getComponent(Label).string = this.hero.tals[0] const sprite = this.node.getChildByName("sk2").getChildByName("skicon").getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
tal.getChildByName("slv2").getChildByName("val").getComponent(Label).string = this.hero.tals[1] sprite.spriteFrame = atlas.getSpriteFrame(skill2.path);
tal.getChildByName("slv3").getChildByName("val").getComponent(Label).string = this.hero.tals[2] });
tal.getChildByName("slv4").getChildByName("val").getComponent(Label).string = this.hero.tals[3] this.node.getChildByName("sk2").getChildByName("name").getComponent(Label).string = skill2.name;
tal.getChildByName("slv5").getChildByName("val").getComponent(Label).string = this.hero.tals[4] 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() this.update_data()
} }
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("ap").getComponent(Label).string = "+"+this.hero.ap_up
lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_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("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("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() 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(){ slv_up(){
if(this.role.slv>=5){ if(this.role.slv>=5){
oops.gui.toast("已经满星,升失败"); oops.gui.toast("已经满星,升失败");
return return
} }
if(smc.heros[this.h_uuid].num < ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))){ 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 return
} }
smc.heros[this.h_uuid].num -= SlvUp[this.role.slv]*(1+this.role.slv) smc.heros[this.h_uuid].num -= SlvUp[this.role.slv]*(1+this.role.slv)

View File

@@ -49,7 +49,7 @@ export class ItemInfoComp extends CCComp {
if(args.type==1){ //技能碎片 if(args.type==1){ //技能碎片
this.node.getChildByName("skill").active = true; this.node.getChildByName("skill").active = true;
this.node.getChildByName("name").getComponent(Label).string=SkillSet[args.uuid].name+" 碎片" this.node.getChildByName("name").getComponent(Label).string=SkillSet[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+SkillSet[args.uuid].name+"」碎片,用于技能升" this.node.getChildByName("info").getComponent(Label).string="「"+SkillSet[args.uuid].name+"」碎片,用于技能升"
var icon_path = "game/skills/skill_icon" var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("skill").getChildByName("skill").getChildByName("icon").getComponent(Sprite); const sprite = this.node.getChildByName("skill").getChildByName("skill").getChildByName("icon").getComponent(Sprite);
@@ -62,7 +62,7 @@ export class ItemInfoComp extends CCComp {
if(args.type==2){ //英雄碎片 if(args.type==2){ //英雄碎片
this.node.getChildByName("hero").active = true this.node.getChildByName("hero").active = true
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片" 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+"」碎片,用于英雄升"
var icon_path = "game/heros/herois" var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("hero").getChildByName("icon").getComponent(Sprite); const sprite = this.node.getChildByName("hero").getChildByName("hero").getChildByName("icon").getComponent(Sprite);