From 6e38e062b75c4b18751fc2b3590f34c8ce632b10 Mon Sep 17 00:00:00 2001 From: panFD Date: Sun, 30 Aug 2026 22:54:44 +0800 Subject: [PATCH] feat(map): add inactive skill icon background toggle logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增技能未激活时的图标背景显示逻辑,添加对应的节点引用和更新方法,实现1级档位未解锁时显示背景的功能 --- assets/script/game/map/SinfoComp.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/assets/script/game/map/SinfoComp.ts b/assets/script/game/map/SinfoComp.ts index 9d036da1..1a833f45 100644 --- a/assets/script/game/map/SinfoComp.ts +++ b/assets/script/game/map/SinfoComp.ts @@ -125,6 +125,10 @@ export class SinfoComp extends CCComp { @property({ type: Node, displayName: "关闭按钮" }) 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!)); + // 未激活图标背景:1 级档位未解锁时显示 + this.updateInactiveBg(heroLv >= tiers[0].heroLv); + // 技能 1 级:激活状态与 2/3 级面板同一表示方式(描述已在 main_info 展示,此处仅渲染状态) 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 组件移除时销毁节点 */ reset() { if (this.node && this.node.isValid) {