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

@@ -37,23 +37,23 @@
"__id__": 64 "__id__": 64
}, },
{ {
"__id__": 70 "__id__": 80
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 86 "__id__": 100
}, },
{ {
"__id__": 88 "__id__": 102
}, },
{ {
"__id__": 90 "__id__": 104
} }
], ],
"_prefab": { "_prefab": {
"__id__": 92 "__id__": 106
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1534,142 +1534,6 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "Icon_Lock03",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 65
},
{
"__id__": 67
}
],
"_prefab": {
"__id__": 69
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 73.924,
"y": 103.982,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 64
},
"_enabled": true,
"__prefab": {
"__id__": 66
},
"_contentSize": {
"__type__": "cc.Size",
"width": 71,
"height": 93
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "96CNC5WcxHCLj/0rraN4ac"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 64
},
"_enabled": true,
"__prefab": {
"__id__": 68
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@cebb2",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e2OtALK6NGW4VjKFngrgE6"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "8dVVuSmoNM8LK80ldyL0K7",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "max", "_name": "max",
@@ -1680,20 +1544,20 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 71 "__id__": 65
}, },
{ {
"__id__": 77 "__id__": 71
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 83 "__id__": 77
} }
], ],
"_prefab": { "_prefab": {
"__id__": 85 "__id__": 79
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1730,20 +1594,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 70 "__id__": 64
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 72 "__id__": 66
}, },
{ {
"__id__": 74 "__id__": 68
} }
], ],
"_prefab": { "_prefab": {
"__id__": 76 "__id__": 70
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1780,11 +1644,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 71 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 73 "__id__": 67
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1808,11 +1672,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 71 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 75 "__id__": 69
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -1866,20 +1730,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 70 "__id__": 64
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 78 "__id__": 72
}, },
{ {
"__id__": 80 "__id__": 74
} }
], ],
"_prefab": { "_prefab": {
"__id__": 82 "__id__": 76
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1916,11 +1780,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 77 "__id__": 71
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 79 "__id__": 73
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1944,11 +1808,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 77 "__id__": 71
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 81 "__id__": 75
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -2025,11 +1889,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 70 "__id__": 64
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 84 "__id__": 78
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2060,6 +1924,451 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "noactive",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 81
},
{
"__id__": 89
}
],
"_active": true,
"_components": [
{
"__id__": 95
},
{
"__id__": 97
}
],
"_prefab": {
"__id__": 99
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "blue",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 80
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 82
},
{
"__id__": 84
},
{
"__id__": 86
}
],
"_prefab": {
"__id__": 88
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.4,
"y": 1.4,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
},
"_enabled": true,
"__prefab": {
"__id__": 83
},
"_contentSize": {
"__type__": "cc.Size",
"width": 154,
"height": 200
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "02tqPPrY1Mx4HziZh79O+F"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
},
"_enabled": true,
"__prefab": {
"__id__": 85
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 170,
"g": 170,
"b": 170,
"a": 109
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@c7ff0",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6VaY56hpLGYTqYxL4G8G4"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
},
"_enabled": false,
"__prefab": {
"__id__": 87
},
"_alignFlags": 45,
"_target": null,
"_left": 33,
"_right": 33,
"_top": 96.5,
"_bottom": 96.5,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 154,
"_originalHeight": 77,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "24wCrMoqJLHY7n4+pMDcEH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "7aU9V35MxJiYyfCI9NBo6N",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Icon_Lock03",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 80
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 90
},
{
"__id__": 92
}
],
"_prefab": {
"__id__": 94
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -102.773,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.1,
"y": 1.1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 89
},
"_enabled": true,
"__prefab": {
"__id__": 91
},
"_contentSize": {
"__type__": "cc.Size",
"width": 71,
"height": 93
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "96CNC5WcxHCLj/0rraN4ac"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 89
},
"_enabled": true,
"__prefab": {
"__id__": 93
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@cebb2",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e2OtALK6NGW4VjKFngrgE6"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "8dVVuSmoNM8LK80ldyL0K7",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 80
},
"_enabled": true,
"__prefab": {
"__id__": 96
},
"_contentSize": {
"__type__": "cc.Size",
"width": 220,
"height": 270
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fbVeBmzjlD0rSwQ/9qQKpZ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 80
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "20viM7np1ERq6mlLUuvKyu"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "f9kgfFlvZJrrGoujOuKQJ1",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -2070,7 +2379,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 87 "__id__": 101
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2098,7 +2407,7 @@
}, },
"_enabled": false, "_enabled": false,
"__prefab": { "__prefab": {
"__id__": 89 "__id__": 103
}, },
"_alignFlags": 40, "_alignFlags": 40,
"_target": null, "_target": null,
@@ -2134,7 +2443,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 91 "__id__": 105
}, },
"lbl_name": { "lbl_name": {
"__id__": 49 "__id__": 49
@@ -2152,9 +2461,11 @@
"__id__": 2 "__id__": 2
}, },
"node_max": { "node_max": {
"__id__": 70 "__id__": 64
},
"node_lock": {
"__id__": 80
}, },
"node_lock": null,
"_id": "" "_id": ""
}, },
{ {
@@ -2173,7 +2484,7 @@
"instance": null, "instance": null,
"targetOverrides": [ "targetOverrides": [
{ {
"__id__": 93 "__id__": 107
} }
] ]
}, },
@@ -2186,7 +2497,7 @@
], ],
"target": null, "target": null,
"targetInfo": { "targetInfo": {
"__id__": 94 "__id__": 108
} }
}, },
{ {

View File

@@ -571,13 +571,14 @@ export class HerosListComp extends CCComp {
* 弹窗按整组合并渲染(组内多技能/词条统一说明) * 弹窗按整组合并渲染(组内多技能/词条统一说明)
* @param normalLv2 普攻 lv2 专属模式:该图标代表普攻 lv2 强化档,名称/图标取 lv1, * @param normalLv2 普攻 lv2 专属模式:该图标代表普攻 lv2 强化档,名称/图标取 lv1,
* 弹窗只展示 lv2 档位说明 * 弹窗只展示 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) const node = instantiate(this.skill_icon_prefab)
node.name = `skill_${s_uuid}` node.name = `skill_${s_uuid}`
const comp = node.getComponent(SSkillBoxComp) || node.addComponent(SSkillBoxComp) 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) this.skills_node.addChild(node)
} }
@@ -604,7 +605,7 @@ export class HerosListComp extends CCComp {
} }
} }
const pick = active ?? sorted[0] 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 const firstUuid = pick.uuids[0]?.uuid
if (!firstUuid) return if (!firstUuid) return
// 词条档位无 s_lv 概念,技能等级恒为 1(等级标签展示技能等级而非解锁的英雄等级) // 词条档位无 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),无需单独处理 */ /** 复活技能已纳入 dead 触发组,通过 dead 配置展示(revive_hp / revive_count),无需单独处理 */
@@ -636,7 +637,7 @@ export class HerosListComp extends CCComp {
const entry = normal?.lv_entries?.[0] const entry = normal?.lv_entries?.[0]
if (!normal || !entry) return if (!normal || !entry) return
// 节点命名区分 lv2 档(普攻与触发槽位可能同底座,uuid 重名会互相干扰) // 节点命名区分 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] const icon = this.skills_node.children[this.skills_node.children.length - 1]
if (icon) icon.name = `skill_${normal.uuid}_lv2` if (icon) icon.name = `skill_${normal.uuid}_lv2`
} }

View File

@@ -66,6 +66,8 @@ export class SSkillBoxComp extends CCComp {
private hero_icon_source?: "skill" | "field"; private hero_icon_source?: "skill" | "field";
/** bonus 档位模式:该图标代表英雄额外属性加成的某一档(图鉴展示,无技能底座 uuid) */ /** bonus 档位模式:该图标代表英雄额外属性加成的某一档(图鉴展示,无技能底座 uuid) */
private bonus_entry?: LvBonusAttrsEntry; private bonus_entry?: LvBonusAttrsEntry;
/** 未激活时的解锁所需英雄等级(用于"x级解锁"展示,与技能等级 rarity 解耦) */
private unlock_lv?: number;
/** 点击事件是否已注册(防止重复绑定) */ /** 点击事件是否已注册(防止重复绑定) */
private _clickRegistered: boolean = false; private _clickRegistered: boolean = false;
@@ -153,13 +155,16 @@ export class SSkillBoxComp extends CCComp {
* 弹窗按整组合并渲染(组内多技能/词条统一说明) * 弹窗按整组合并渲染(组内多技能/词条统一说明)
* @param normalLv2 普攻 lv2+ 强化档专属模式:名称/图标取 lv1,弹窗只展示 lv2+ 档位说明; * @param normalLv2 普攻 lv2+ 强化档专属模式:名称/图标取 lv1,弹窗只展示 lv2+ 档位说明;
* 等级显示偏移一档(配置 Lv2 → 显示 Lv1,Lv3 → 显示 Lv2),强化档从 1 起计 * 等级显示偏移一档(配置 Lv2 → 显示 Lv1,Lv3 → 显示 Lv2),强化档从 1 起计
*/ * @param unlockLv 未激活时的解锁所需英雄等级(触发/光环/强化档未达解锁条件时展示"x级解锁",
initHeroSkill(s_uuid: number, s_lv: number, locked: boolean, isField: boolean = false, heroUuid: number = 0, slot?: SkillTriggerType, isGroup: boolean = false, normalLv2: boolean = false) { * 与技能等级 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.s_uuid = s_uuid;
this.hero_uuid = heroUuid; this.hero_uuid = heroUuid;
this.hero_slot = slot; this.hero_slot = slot;
this.hero_group = isGroup; this.hero_group = isGroup;
this.hero_normal_lv2 = normalLv2; this.hero_normal_lv2 = normalLv2;
this.unlock_lv = unlockLv;
// 普攻 lv2+ 强化档:等级显示偏移一档(配置 Lv2 显示 Lv1,Lv3 显示 Lv2), // 普攻 lv2+ 强化档:等级显示偏移一档(配置 Lv2 显示 Lv1,Lv3 显示 Lv2),
// 强化档作为独立于普攻的技能存在,等级从 1 起计 // 强化档作为独立于普攻的技能存在,等级从 1 起计
this.rarity = normalLv2 ? Math.max(1, s_lv - 1) : s_lv; this.rarity = normalLv2 ? Math.max(1, s_lv - 1) : s_lv;
@@ -170,8 +175,8 @@ export class SSkillBoxComp extends CCComp {
/** /**
* 设置技能激活状态: * 设置技能激活状态:
* - locked = true → 显示锁定遮罩,技能未激活(隐藏等级标签) * - locked = true → 显示锁定遮罩,技能未激活(隐藏等级标签,名称标签显示"x级解锁")
* - locked = false → 隐藏锁定遮罩,技能已激活(恢复等级标签) * - locked = false → 隐藏锁定遮罩,技能已激活(恢复等级标签与技能名)
*/ */
setLocked(locked: boolean) { setLocked(locked: boolean) {
if (this.locked) { if (this.locked) {
@@ -180,6 +185,10 @@ export class SSkillBoxComp extends CCComp {
if (this.lv_label) { if (this.lv_label) {
this.lv_label.node.active = !locked; 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();
}
} }
/** /**