diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index 67ccff60..9646a165 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -137,6 +137,10 @@ export class HeroAttrsComp extends ecs.Comp { if(!isValue){ addValue = value * this.Attrs[Attrs.MP_MAX]; } + let heroView = this.ent.get(HeroViewComp); + if(heroView){ + heroView.mp_add(addValue); + } this.mp += addValue; this.mp = Math.max(0, Math.min(this.mp, this.Attrs[Attrs.MP_MAX])); } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index b5e8a534..37c569cd 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -174,13 +174,7 @@ export class HeroViewComp extends CCComp { this.top_node.getChildByName("mp").getChildByName("mpb").getComponent(ProgressBar).progress = mp / mp_max; }, 0.15); } - private pow_show(pow: number, pow_max: number) { - if(!this.top_node.active) return - this.top_node.getChildByName("pow").getComponent(ProgressBar).progress = pow / pow_max; - this.scheduleOnce(() => { - this.top_node.getChildByName("pow").getChildByName("mpb").getComponent(ProgressBar).progress = pow / pow_max; - }, 0.15); - } + /** 升级特效 */ private lv_up() { var path = "game/skill/buff/buff_lvup"; @@ -296,7 +290,7 @@ export class HeroViewComp extends CCComp { this.top_node.active=true this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]); } - mp(mp: number = 0) { + mp_add(mp: number = 0) { // 生命值更新由 Model 层处理,这里只负责视图表现 this.hp_tip(TooltipTypes.addmp, mp.toFixed(0)); this.top_node.active=true