refactor(hero): 移除多余的日志输出并简化代码逻辑
本次提交清理了多个英雄相关组件中的调试日志,同时简化了条件判断写法: 1. 将多行if判断简化为单行return形式 2. 删除HeroViewComp中护盾特效相关的冗余日志和节点查找逻辑 3. 优化absorbShield和add_shield等方法的代码可读性
This commit is contained in:
@@ -137,16 +137,11 @@ export class HeroTopBarComp extends CCComp {
|
||||
|
||||
/** 更新护盾数值条(显示具体数值,无上限) */
|
||||
public shieldShow(shield: number = 0): void {
|
||||
if (!this.shieldProgressBar) {
|
||||
console.log('[HeroTopBarComp] shieldShow: shieldProgressBar is null');
|
||||
return;
|
||||
}
|
||||
if (!this.shieldProgressBar) return;
|
||||
// 护盾条直接显示具体数值,progress 固定为 1(满条显示)
|
||||
this.shieldProgressBar.progress = 1;
|
||||
// 护盾节点显隐
|
||||
const shouldActive = shield > 0;
|
||||
console.log(`[HeroTopBarComp] shieldShow: shield=${shield}, active=${shouldActive}, node=${this.shieldProgressBar.node.name}`);
|
||||
this.shieldProgressBar.node.active = shouldActive;
|
||||
this.shieldProgressBar.node.active = shield > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user