英雄碎片完成

This commit is contained in:
2024-12-16 20:32:04 +08:00
parent 4ef310674a
commit 85e43929ad
13 changed files with 2904 additions and 18691 deletions

View File

@@ -1,4 +1,4 @@
import { _decorator,Button,EventHandler,EventTouch,instantiate,Label,NodeEventType,Prefab,resources,Sprite,SpriteAtlas,tween,UITransform,v3 } from "cc";
import { _decorator,Button,EventHandler,EventTouch,instantiate,Label,NodeEventType,Prefab,ProgressBar,resources,Sprite,SpriteAtlas,tween,UITransform,v3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroInfo, HeroList } from "../common/config/heroSet";
@@ -9,6 +9,7 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
import { Items } from "../common/config/Items";
import { SkillSet } from "../common/config/SkillSet";
import { LvUp, SlvUp, UpGold } from "../common/config/RoleSet";
import { HChipComp } from "../hero/HChipComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -81,17 +82,20 @@ export class HeroHomeComp extends CCComp {
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("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
lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_up
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("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[1]+this.hero.slvexp)*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("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
slvup.getChildByName("cost").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))
let hchipcomp= slvup.getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
hchipcomp.update_data(this.h_uuid,0)
//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+"%"
@@ -152,31 +156,26 @@ export class HeroHomeComp extends CCComp {
lv_up(){
if(smc.vmdata.items[1001].num < ((LvUp[0]+this.hero.lvexp)*this.role.lv)||smc.vmdata.items[9001].num < (UpGold.LvUp*this.role.lv)){
if(smc.vmdata.items[1001].num < ((LvUp[0]+this.hero.lvexp)*this.role.lv)){
oops.gui.toast("资源不足,升级失败");
return
}
smc.vmdata.items[1001].num -= ((LvUp[0]+this.hero.lvexp)*this.role.lv)
smc.vmdata.items[9001].num -= (UpGold.LvUp*this.role.lv)
this.role.lv++
this.update_data()
}
slv_up(){
if(this.role.slv>=5){
oops.gui.toast("已经满星,升星失败");
return
}
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))){
if(smc.heros[this.h_uuid].num < ((SlvUp[this.role.slv]-HeroInfo[this.h_uuid].slvexp)*(1+this.role.slv))){
oops.gui.toast("资源不足,升星失败");
return
}
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()
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);