feat(map): add inactive skill icon background toggle logic

新增技能未激活时的图标背景显示逻辑,添加对应的节点引用和更新方法,实现1级档位未解锁时显示背景的功能
This commit is contained in:
panFD
2026-08-30 22:54:44 +08:00
parent a7e9bb2ace
commit 6e38e062b7

View File

@@ -125,6 +125,10 @@ export class SinfoComp extends CCComp {
@property({ type: Node, displayName: "关闭按钮" }) @property({ type: Node, displayName: "关闭按钮" })
private close_btn: Node = null; private close_btn: Node = null;
/** 技能未激活图标背景(技能未激活时显示,已激活隐藏) */
@property({ type: Node, displayName: "未激活图标背景" })
private inactive_bg: Node = null;
// ======================== 运行时状态 ======================== // ======================== 运行时状态 ========================
/** 弹窗参数 */ /** 弹窗参数 */
@@ -242,6 +246,9 @@ export class SinfoComp extends CCComp {
// 英雄当前局外等级:激活判定基准 // 英雄当前局外等级:激活判定基准
const heroLv = Math.max(1, smc.getHeroOuterLv(p.hero_uuid!)); const heroLv = Math.max(1, smc.getHeroOuterLv(p.hero_uuid!));
// 未激活图标背景:1 级档位未解锁时显示
this.updateInactiveBg(heroLv >= tiers[0].heroLv);
// 技能 1 级:激活状态与 2/3 级面板同一表示方式(描述已在 main_info 展示,此处仅渲染状态) // 技能 1 级:激活状态与 2/3 级面板同一表示方式(描述已在 main_info 展示,此处仅渲染状态)
this.renderLvPanelFromTier(tiers[0], heroLv, this.main_status, null); this.renderLvPanelFromTier(tiers[0], heroLv, this.main_status, null);
@@ -427,6 +434,16 @@ export class SinfoComp extends CCComp {
} }
} }
/**
* 更新未激活图标背景显隐
* @param unlocked 技能是否已激活
*/
private updateInactiveBg(unlocked: boolean) {
if (this.inactive_bg && this.inactive_bg.isValid) {
this.inactive_bg.active = !unlocked;
}
}
/** ECS 组件移除时销毁节点 */ /** ECS 组件移除时销毁节点 */
reset() { reset() {
if (this.node && this.node.isValid) { if (this.node && this.node.isValid) {