fix(skillBox): 修复技能盒数字标签空值仍占位的问题
当技能盒没有剩余数值时,隐藏整个数字标签节点,避免空字符串标签仍占用布局空间
This commit is contained in:
@@ -461,8 +461,11 @@ export class SkillBoxComp extends CCComp {
|
|||||||
const remain = Math.max(0, Math.floor(total) - used);
|
const remain = Math.max(0, Math.floor(total) - used);
|
||||||
this.num_label.string = `${remain}`;
|
this.num_label.string = `${remain}`;
|
||||||
}
|
}
|
||||||
|
// 有数值才显示,无数值隐藏整个节点(避免 Label 空字符串仍占位)
|
||||||
|
this.num_label.node.active = true;
|
||||||
} else {
|
} else {
|
||||||
this.num_label.string = "";
|
this.num_label.string = "";
|
||||||
|
this.num_label.node.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user