feat(skillBox): add hero level unlock prompt for locked skills

1. 新增unlock_lv字段存储技能解锁所需英雄等级,与技能等级解耦
2. 优化锁定状态下的UI展示:优先显示等级解锁提示,回退使用技能等级
3. 重构技能图标生成逻辑,传递解锁等级参数
4. 更新天赋道具预制体,适配新的解锁提示UI展示逻辑
This commit is contained in:
panFD
2026-09-08 20:04:27 +08:00
parent 056feba945
commit 07f1646013
3 changed files with 500 additions and 179 deletions

View File

@@ -571,13 +571,14 @@ export class HerosListComp extends CCComp {
* 弹窗按整组合并渲染(组内多技能/词条统一说明)
* @param normalLv2 普攻 lv2 专属模式:该图标代表普攻 lv2 强化档,名称/图标取 lv1,
* 弹窗只展示 lv2 档位说明
* @param unlockLv 未激活时的解锁所需英雄等级(用于"x级解锁"展示,与技能等级 s_lv 解耦)
*/
private addSkillIcon(s_uuid: number, s_lv: number, locked: boolean, isField: boolean, slot?: SkillTriggerType, isGroup: boolean = false, normalLv2: boolean = false) {
private addSkillIcon(s_uuid: number, s_lv: number, locked: boolean, isField: boolean, slot?: SkillTriggerType, isGroup: boolean = false, normalLv2: boolean = false, unlockLv?: number) {
const node = instantiate(this.skill_icon_prefab)
node.name = `skill_${s_uuid}`
const comp = node.getComponent(SSkillBoxComp) || node.addComponent(SSkillBoxComp)
// 携带所属英雄与槽位,点击弹窗按英雄技能分档描述渲染
comp.initHeroSkill(s_uuid, s_lv, locked, isField, this.huuid, slot, isGroup, normalLv2)
comp.initHeroSkill(s_uuid, s_lv, locked, isField, this.huuid, slot, isGroup, normalLv2, unlockLv)
this.skills_node.addChild(node)
}
@@ -604,7 +605,7 @@ export class HerosListComp extends CCComp {
}
}
const pick = active ?? sorted[0]
this.addSkillIcon(keys[0], pick.s_lv ?? 1, !anyActive, false, type, true)
this.addSkillIcon(keys[0], pick.s_lv ?? 1, !anyActive, false, type, true, false, anyActive ? undefined : pick.lv)
}
/**
@@ -620,7 +621,7 @@ export class HerosListComp extends CCComp {
const firstUuid = pick.uuids[0]?.uuid
if (!firstUuid) return
// 词条档位无 s_lv 概念,技能等级恒为 1(等级标签展示技能等级而非解锁的英雄等级)
this.addSkillIcon(firstUuid, 1, !active, true, SkillTriggerType.Field, true)
this.addSkillIcon(firstUuid, 1, !active, true, SkillTriggerType.Field, true, false, active ? undefined : pick.lv)
}
/** 复活技能已纳入 dead 触发组,通过 dead 配置展示(revive_hp / revive_count),无需单独处理 */
@@ -636,7 +637,7 @@ export class HerosListComp extends CCComp {
const entry = normal?.lv_entries?.[0]
if (!normal || !entry) return
// 节点命名区分 lv2 档(普攻与触发槽位可能同底座,uuid 重名会互相干扰)
this.addSkillIcon(normal.uuid, entry.s_lv ?? 2, lv < entry.lv, false, undefined, false, true)
this.addSkillIcon(normal.uuid, entry.s_lv ?? 2, lv < entry.lv, false, undefined, false, true, entry.lv)
const icon = this.skills_node.children[this.skills_node.children.length - 1]
if (icon) icon.name = `skill_${normal.uuid}_lv2`
}