英雄升级 重做, 修改为 需要碎片激活

This commit is contained in:
2024-12-16 16:37:03 +08:00
parent 70cac957a9
commit 4ef310674a
2 changed files with 1000 additions and 5829 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -73,6 +73,14 @@ export class HeroHomeComp extends CCComp {
let attr = this.node.getChildByName("attr");
let attr2 = this.node.getChildByName("attr2").getChildByName("other");
this.node.getChildByName("name").getChildByName("lv").getComponent(Label).string = this.role.lv.toString()+"级";
if( this.role.slv>=1) {slv_node.getChildByName("s1").active=true}else{slv_node.getChildByName("s1").active=false};
if( this.role.slv>=2) {slv_node.getChildByName("s2").active=true}else{slv_node.getChildByName("s2").active=false};
if( this.role.slv>=3) {slv_node.getChildByName("s3").active=true}else{slv_node.getChildByName("s3").active=false};
if( this.role.slv>=4) {slv_node.getChildByName("s4").active=true}else{slv_node.getChildByName("s4").active=false};
if( this.role.slv>=5) {slv_node.getChildByName("s5").active=true}else{slv_node.getChildByName("s5").active=false};
lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*this.role.lv).toString()
lvup.getChildByName("item").getChildByName("need").getComponent(Label).string = ((LvUp[0]+this.hero.lvexp)*this.role.lv).toString()
lvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.ap_up
@@ -80,29 +88,17 @@ export class HeroHomeComp extends CCComp {
lvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.hp_up
slvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*(this.role.slv+1)).toString()
slvup.getChildByName("lv1").getChildByName("need").getComponent(Label).string = ((SlvUp[1]+this.hero.slvexp)*1).toString()
slvup.getChildByName("lv2").getChildByName("need").getComponent(Label).string = ((SlvUp[2]+this.hero.slvexp)*2).toString()
slvup.getChildByName("lv3").getChildByName("need").getComponent(Label).string = ((SlvUp[3]+this.hero.slvexp)*3).toString()
slvup.getChildByName("lv4").getChildByName("need").getComponent(Label).string = ((SlvUp[4]+this.hero.slvexp)*4).toString()
slvup.getChildByName("lv5").getChildByName("need").getComponent(Label).string = ((SlvUp[5]+this.hero.slvexp)*5).toString()
slvup.getChildByName("lv6").getChildByName("need").getComponent(Label).string = ((SlvUp[6]+this.hero.slvexp)*6).toString()
slvup.getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[1]+this.hero.slvexp)*1).toString()
slvup.getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
//todo cost icon 需要通过预制体进行变更
slvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.sap_up+"%"
slvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.sdef_up+"%"
slvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.shp_up+"%"
if( this.role.slv>=1) {slv_node.getChildByName("s1").active=true}else{slv_node.getChildByName("s1").active=false};
if( this.role.slv>=2) {slv_node.getChildByName("s2").active=true}else{slv_node.getChildByName("s2").active=false};
if( this.role.slv>=3) {slv_node.getChildByName("s3").active=true}else{slv_node.getChildByName("s3").active=false};
if( this.role.slv>=4) {slv_node.getChildByName("s4").active=true}else{slv_node.getChildByName("s4").active=false};
if( this.role.slv>=5) {slv_node.getChildByName("s5").active=true}else{slv_node.getChildByName("s5").active=false};
if( this.role.slv==0) {slvup.getChildByName("lv1").active=true}else{slvup.getChildByName("lv1").active=false};
if( this.role.slv==1) {slvup.getChildByName("lv2").active=true}else{slvup.getChildByName("lv2").active=false};
if( this.role.slv==2) {slvup.getChildByName("lv3").active=true}else{slvup.getChildByName("lv3").active=false};
if( this.role.slv==3) {slvup.getChildByName("lv4").active=true}else{slvup.getChildByName("lv4").active=false};
if( this.role.slv==4) {slvup.getChildByName("lv5").active=true}else{slvup.getChildByName("lv5").active=false};
if( this.role.slv==5) {
slvup.getChildByName("lv6").active=true;slvup.getChildByName("btned").active=true
slvup.getChildByName("btned").active=true
}else{
slvup.getChildByName("lv6").active=false;slvup.getChildByName("btned").active=false
slvup.getChildByName("btned").active=false
};
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* this.role.lv)*(1+this.hero.sap_up/100*this.role.slv)).toFixed(0).toString()
@@ -171,29 +167,11 @@ export class HeroHomeComp extends CCComp {
oops.gui.toast("已经满星,升星失败");
return
}
let has =1002
switch(this.role.slv){
case 1:
has=1003
break;
case 2:
has=1004
break;
case 3:
has=1005
break;
case 4:
has=1006
break;
case 5:
has=1006
break;
}
if(smc.vmdata.items[has].num < ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)||smc.vmdata.items[9001].num < (UpGold.SlvUp*(this.role.slv+1))){
if(smc.heros[this.h_uuid].num < SlvUp[this.role.slv]*(1+this.role.slv)||smc.vmdata.items[9001].num < (UpGold.SlvUp*(this.role.slv+1))){
oops.gui.toast("资源不足,升星失败");
return
}
smc.vmdata.items[has].num -= ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)
smc.heros[this.h_uuid].num -= SlvUp[this.role.slv]*(1+this.role.slv)
smc.vmdata.items[9001].num -= (UpGold.SlvUp*(this.role.slv+1))
this.role.slv++
this.update_data()