feat(skillBox): add hero level unlock prompt for locked skills
1. 新增unlock_lv字段存储技能解锁所需英雄等级,与技能等级解耦 2. 优化锁定状态下的UI展示:优先显示等级解锁提示,回退使用技能等级 3. 重构技能图标生成逻辑,传递解锁等级参数 4. 更新天赋道具预制体,适配新的解锁提示UI展示逻辑
This commit is contained in:
@@ -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`
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ export class SSkillBoxComp extends CCComp {
|
||||
private hero_icon_source?: "skill" | "field";
|
||||
/** bonus 档位模式:该图标代表英雄额外属性加成的某一档(图鉴展示,无技能底座 uuid) */
|
||||
private bonus_entry?: LvBonusAttrsEntry;
|
||||
/** 未激活时的解锁所需英雄等级(用于"x级解锁"展示,与技能等级 rarity 解耦) */
|
||||
private unlock_lv?: number;
|
||||
|
||||
/** 点击事件是否已注册(防止重复绑定) */
|
||||
private _clickRegistered: boolean = false;
|
||||
@@ -153,13 +155,16 @@ export class SSkillBoxComp extends CCComp {
|
||||
* 弹窗按整组合并渲染(组内多技能/词条统一说明)
|
||||
* @param normalLv2 普攻 lv2+ 强化档专属模式:名称/图标取 lv1,弹窗只展示 lv2+ 档位说明;
|
||||
* 等级显示偏移一档(配置 Lv2 → 显示 Lv1,Lv3 → 显示 Lv2),强化档从 1 起计
|
||||
*/
|
||||
initHeroSkill(s_uuid: number, s_lv: number, locked: boolean, isField: boolean = false, heroUuid: number = 0, slot?: SkillTriggerType, isGroup: boolean = false, normalLv2: boolean = false) {
|
||||
* @param unlockLv 未激活时的解锁所需英雄等级(触发/光环/强化档未达解锁条件时展示"x级解锁",
|
||||
* 与技能等级 s_lv 解耦;未传时回退按 rarity 显示)
|
||||
*/
|
||||
initHeroSkill(s_uuid: number, s_lv: number, locked: boolean, isField: boolean = false, heroUuid: number = 0, slot?: SkillTriggerType, isGroup: boolean = false, normalLv2: boolean = false, unlockLv?: number) {
|
||||
this.s_uuid = s_uuid;
|
||||
this.hero_uuid = heroUuid;
|
||||
this.hero_slot = slot;
|
||||
this.hero_group = isGroup;
|
||||
this.hero_normal_lv2 = normalLv2;
|
||||
this.unlock_lv = unlockLv;
|
||||
// 普攻 lv2+ 强化档:等级显示偏移一档(配置 Lv2 显示 Lv1,Lv3 显示 Lv2),
|
||||
// 强化档作为独立于普攻的技能存在,等级从 1 起计
|
||||
this.rarity = normalLv2 ? Math.max(1, s_lv - 1) : s_lv;
|
||||
@@ -170,8 +175,8 @@ export class SSkillBoxComp extends CCComp {
|
||||
|
||||
/**
|
||||
* 设置技能激活状态:
|
||||
* - locked = true → 显示锁定遮罩,技能未激活(隐藏等级标签)
|
||||
* - locked = false → 隐藏锁定遮罩,技能已激活(恢复等级标签)
|
||||
* - locked = true → 显示锁定遮罩,技能未激活(隐藏等级标签,名称标签显示"x级解锁")
|
||||
* - locked = false → 隐藏锁定遮罩,技能已激活(恢复等级标签与技能名)
|
||||
*/
|
||||
setLocked(locked: boolean) {
|
||||
if (this.locked) {
|
||||
@@ -180,6 +185,10 @@ export class SSkillBoxComp extends CCComp {
|
||||
if (this.lv_label) {
|
||||
this.lv_label.node.active = !locked;
|
||||
}
|
||||
if (this.name_label) {
|
||||
// 未激活时不展示技能名,改为展示解锁条件(优先取英雄等级阈值 unlock_lv,回退技能等级 rarity)
|
||||
this.name_label.string = locked ? `${this.unlock_lv ?? this.rarity}级解锁` : this.resolveSkillName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user