This commit is contained in:
2025-05-27 10:57:42 +08:00
parent 424edb89a7
commit cdb09a5ca1
13 changed files with 867 additions and 555 deletions

View File

@@ -39,13 +39,19 @@ export class BuffComp extends Component {
info_init(){
this.top_node = this.node.getChildByName("top");
this.top_node.getChildByName("lv").active=(this.node.getComponent(HeroViewComp).fac == 0 ? true : false)
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
this.top_node.getChildByName("sboss").active=this.node.getComponent(HeroViewComp).is_boss
this.top_node.getChildByName("lv").getChildByName("lv").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).lv.toFixed(0)
this.top_node.getChildByName("ihp").getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).hp.toFixed(0)
this.top_node.getChildByName("iap").getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).ap.toFixed(0)
this.top_node.getChildByName("ihp").active=false
this.top_node.getChildByName("iap").active=false
}
update(deltaTime: number) {
if(smc.mission.pause) return
// this.hp_show()
this.hp_show()
if(this.wind_cd > 0 ) this.wind_cd -= deltaTime;
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
this.node.getChildByName("wind").active = false;
@@ -55,25 +61,16 @@ export class BuffComp extends Component {
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
this.node.getChildByName("buff").active = false;
}
this.in_speek(deltaTime)
}
hp_show(){
if(this.node.getComponent(HeroViewComp).fac == 0) {
this.top_node.getChildByName("hp").active = false;
this.update_info_hp()
}else{
this.top_node.getChildByName("lv").active = true;
let hp=this.node.getComponent(HeroViewComp).hp;
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
let hp_progress= hp/hp_max;
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.node.getComponent(HeroViewComp).is_boss) return
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
}
// if(this.node.getComponent(HeroViewComp).fac == 0) return
let hp=this.node.getComponent(HeroViewComp).hp;
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
let hp_progress= hp/hp_max;
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.node.getComponent(HeroViewComp).is_boss) return
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
}
show_shield(val:boolean){
this.node.getChildByName("shielded").active=val
@@ -89,7 +86,10 @@ export class BuffComp extends Component {
iap_node.getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).ap.toFixed(0)
}
update_info_lv(){
let lv_node = this.top_node.getChildByName("lv");
lv_node.getChildByName("lv").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).lv.toFixed(0)
}
show_wind(t:number=1){
this.wind_cd = t;