fix(英雄属性): 修复MP更新时视图未同步的问题

修改HeroAttrsComp在更新MP值时调用HeroViewComp的mp_add方法同步视图
重命名HeroViewComp的mp方法为mp_add以更准确描述其功能
移除HeroViewComp中未使用的pow_show方法
This commit is contained in:
2025-11-26 10:14:06 +08:00
parent ab4d29d42b
commit df3ad88c3e
2 changed files with 6 additions and 8 deletions

View File

@@ -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