refactor(gui, talent): 调整天赋卡片UI布局与边框参数

feat(talent): 新增天赋面板经验数值与点数统计显示

refactor(hero): 重构英雄列表与详情弹窗排序逻辑

fix(window): 修复弹窗默认激活状态与位置偏移问题
This commit is contained in:
panFD
2026-09-18 23:11:42 +08:00
parent 16854ab1b8
commit f67f8a4aa0
10 changed files with 5736 additions and 977 deletions

View File

@@ -1781,7 +1781,7 @@
"propertyPath": [
"_active"
],
"value": true
"value": false
},
{
"__type__": "cc.TargetInfo",
@@ -1800,7 +1800,7 @@
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": -30,
"y": 0,
"z": 0
}
},
@@ -1821,7 +1821,7 @@
"value": {
"__type__": "cc.Size",
"width": 150,
"height": 95.5
"height": 35.5
}
},
{
@@ -1838,7 +1838,7 @@
"propertyPath": [
"_active"
],
"value": true
"value": false
},
{
"__type__": "cc.TargetInfo",
@@ -1869,7 +1869,7 @@
"propertyPath": [
"_top"
],
"value": -8.2625
"value": 6.737500000000001
},
{
"__type__": "cc.TargetInfo",
@@ -1885,7 +1885,7 @@
"propertyPath": [
"_bottom"
],
"value": -7.237500000000001
"value": 7.762499999999999
},
{
"__type__": "CCPropertyOverrideInfo",
@@ -1933,7 +1933,7 @@
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 2.75,
"y": 17.75,
"z": 0
}
},
@@ -3659,7 +3659,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -30,
"y": 0,
"z": 0
},
"_lrot": {
@@ -3766,7 +3766,7 @@
"__id__": 202
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 208
@@ -4202,7 +4202,7 @@
"__id__": 220
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 226
@@ -4217,7 +4217,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 2.75,
"y": 17.75,
"z": 0
},
"_lrot": {
@@ -4635,7 +4635,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"height": 95.5
"height": 35.5
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -4664,8 +4664,8 @@
"_target": null,
"_left": 0,
"_right": 0,
"_top": -8.2625,
"_bottom": -7.237500000000001,
"_top": 21.7375,
"_bottom": 22.7625,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,

View File

@@ -1083,7 +1083,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 103.54399999999998,
"y": 96.661,
"z": 0
},
"_lrot": {
@@ -1314,8 +1314,8 @@
"_target": null,
"_left": 15,
"_right": 15,
"_top": 11.456000000000017,
"_bottom": 58.54399999999999,
"_top": 18.339,
"_bottom": 51.66100000000001,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,

File diff suppressed because it is too large Load Diff

View File

@@ -37,23 +37,23 @@
"__id__": 64
},
{
"__id__": 80
"__id__": 101
}
],
"_active": true,
"_components": [
{
"__id__": 100
"__id__": 121
},
{
"__id__": 102
"__id__": 123
},
{
"__id__": 104
"__id__": 125
}
],
"_prefab": {
"__id__": 106
"__id__": 127
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1554,21 +1554,24 @@
},
{
"__id__": 71
},
{
"__id__": 92
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 77
"__id__": 98
}
],
"_prefab": {
"__id__": 79
"__id__": 100
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -79.992,
"y": -80.146,
"z": 0
},
"_lrot": {
@@ -1730,6 +1733,278 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 64
},
"_prefab": {
"__id__": 72
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 71
},
"asset": {
"__uuid__": "c85dc4d5-6ebf-4cee-aa3e-6c027334e622",
"__expectedType__": "cc.Prefab"
},
"fileId": "40LEKxke9Hs6tfg2pVspXT",
"instance": {
"__id__": 73
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "bcGGAQVadOp4NqjzQfitOC",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 74
},
{
"__id__": 76
},
{
"__id__": 77
},
{
"__id__": 78
},
{
"__id__": 79
},
{
"__id__": 80
},
{
"__id__": 82
},
{
"__id__": 84
},
{
"__id__": 86
},
{
"__id__": 88
},
{
"__id__": 90
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 75
},
"propertyPath": [
"_name"
],
"value": "Lable"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"40LEKxke9Hs6tfg2pVspXT"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 75
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 75
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 75
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 75
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 0.7,
"y": 0.7,
"z": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 81
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 140,
"height": 100
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"32q1bLzYBFr5SK8ZtIeSWI"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 83
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 140,
"height": 54
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"06bJQzIv9Dd4vvjRlqtfn3"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 85
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 140,
"height": 45
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"8d3sM/DlJKPpJHNKbTBwEP"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 87
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 132,
"height": 44
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"17CdGbg9BG87rd0n06WZvm"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 89
},
"propertyPath": [
"_color"
],
"value": {
"__type__": "cc.Color",
"r": 231,
"g": 231,
"b": 69,
"a": 255
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"4ckA8btpNNTrqJr6S7VGRN"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 91
},
"propertyPath": [
"_color"
],
"value": {
"__type__": "cc.Color",
"r": 213,
"g": 186,
"b": 50,
"a": 255
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"b1UpBBMc9Obp5MBENsf/W/"
]
},
{
"__type__": "cc.Node",
"_name": "Label",
@@ -1742,14 +2017,14 @@
"_active": true,
"_components": [
{
"__id__": 72
"__id__": 93
},
{
"__id__": 74
"__id__": 95
}
],
"_prefab": {
"__id__": 76
"__id__": 97
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1786,11 +2061,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 71
"__id__": 92
},
"_enabled": true,
"__prefab": {
"__id__": 73
"__id__": 94
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1814,11 +2089,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 71
"__id__": 92
},
"_enabled": true,
"__prefab": {
"__id__": 75
"__id__": 96
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -1899,7 +2174,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 78
"__id__": 99
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1940,23 +2215,23 @@
},
"_children": [
{
"__id__": 81
"__id__": 102
},
{
"__id__": 89
"__id__": 110
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 95
"__id__": 116
},
{
"__id__": 97
"__id__": 118
}
],
"_prefab": {
"__id__": 99
"__id__": 120
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1993,23 +2268,23 @@
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 80
"__id__": 101
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 103
},
{
"__id__": 84
"__id__": 105
},
{
"__id__": 86
"__id__": 107
}
],
"_prefab": {
"__id__": 88
"__id__": 109
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -2046,11 +2321,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
"__id__": 102
},
"_enabled": true,
"__prefab": {
"__id__": 83
"__id__": 104
},
"_contentSize": {
"__type__": "cc.Size",
@@ -2074,21 +2349,21 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
"__id__": 102
},
"_enabled": true,
"__prefab": {
"__id__": 85
"__id__": 106
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 170,
"g": 170,
"b": 170,
"a": 109
"r": 255,
"g": 255,
"b": 255,
"a": 192
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@c7ff0",
@@ -2105,7 +2380,7 @@
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_useGrayscale": true,
"_atlas": null,
"_id": ""
},
@@ -2119,11 +2394,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 81
"__id__": 102
},
"_enabled": false,
"__prefab": {
"__id__": 87
"__id__": 108
},
"_alignFlags": 45,
"_target": null,
@@ -2168,20 +2443,20 @@
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 80
"__id__": 101
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 90
"__id__": 111
},
{
"__id__": 92
"__id__": 113
}
],
"_prefab": {
"__id__": 94
"__id__": 115
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -2218,11 +2493,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 89
"__id__": 110
},
"_enabled": true,
"__prefab": {
"__id__": 91
"__id__": 112
},
"_contentSize": {
"__type__": "cc.Size",
@@ -2246,11 +2521,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 89
"__id__": 110
},
"_enabled": true,
"__prefab": {
"__id__": 93
"__id__": 114
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -2307,11 +2582,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 80
"__id__": 101
},
"_enabled": true,
"__prefab": {
"__id__": 96
"__id__": 117
},
"_contentSize": {
"__type__": "cc.Size",
@@ -2335,11 +2610,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 80
"__id__": 101
},
"_enabled": true,
"__prefab": {
"__id__": 98
"__id__": 119
},
"_alignFlags": 45,
"_target": null,
@@ -2388,7 +2663,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 101
"__id__": 122
},
"_contentSize": {
"__type__": "cc.Size",
@@ -2416,7 +2691,7 @@
},
"_enabled": false,
"__prefab": {
"__id__": 103
"__id__": 124
},
"_alignFlags": 40,
"_target": null,
@@ -2452,7 +2727,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 105
"__id__": 126
},
"lbl_name": {
"__id__": 49
@@ -2473,7 +2748,7 @@
"__id__": 64
},
"node_lock": {
"__id__": 80
"__id__": 101
},
"_id": ""
},
@@ -2493,7 +2768,12 @@
"instance": null,
"targetOverrides": [
{
"__id__": 107
"__id__": 128
}
],
"nestedPrefabInstanceRoots": [
{
"__id__": 71
}
]
},
@@ -2506,7 +2786,7 @@
],
"target": null,
"targetInfo": {
"__id__": 108
"__id__": 129
}
},
{

File diff suppressed because it is too large Load Diff

View File

@@ -8166,10 +8166,10 @@
"height": 35,
"rawWidth": 8,
"rawHeight": 35,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 7,
"borderTop": 15,
"borderBottom": 15,
"borderLeft": 1,
"borderRight": 5,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,

View File

@@ -116,8 +116,8 @@
"height": 54,
"rawWidth": 89,
"rawHeight": 54,
"borderTop": 0,
"borderBottom": 0,
"borderTop": 26,
"borderBottom": 26,
"borderLeft": 44,
"borderRight": 44,
"packable": true,
@@ -576,8 +576,8 @@
"height": 45,
"rawWidth": 52,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderTop": 22,
"borderBottom": 23,
"borderLeft": 26,
"borderRight": 26,
"packable": true,
@@ -4992,8 +4992,8 @@
"height": 45,
"rawWidth": 81,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderTop": 22.5,
"borderBottom": 22.5,
"borderLeft": 40,
"borderRight": 40,
"packable": true,
@@ -6096,10 +6096,10 @@
"height": 39,
"rawWidth": 37,
"rawHeight": 39,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"borderTop": 19,
"borderBottom": 18,
"borderLeft": 19,
"borderRight": 18,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,

View File

@@ -6,7 +6,7 @@
* 1. 展示单个英雄的详情:idle 动画、名称、AP / DEF / HP / CD、技能描述、
* 稀有度底框、局外等级、职业、碎片数量、升级按钮、技能图标列表。
* 2. 提供升级操作(消耗碎片提升局外等级,成功后播放升级特效)。
* 3. 提供前后英雄切换按钮,按图鉴排序顺序循环切换(getSortedHeroList)。
* 3. 提供前后英雄切换按钮,按图鉴排序顺序循环切换(品质降序 → uuid 升序)。
* 4. 提供关闭按钮 / 遮罩点击关闭弹窗。
*
* 使用(oops.gui 模块):
@@ -15,12 +15,11 @@
* 关键设计:
* - 详情渲染逻辑与原 HerosListComp 详情面板同源(已迁移至此),
* HerosListComp 仅保留卡片列表,点击卡片改为打开本弹窗。
* - 前后切换按 getSortedHeroList 计算的顺序循环(与图鉴页面卡片顺序一致)。
* - 前后切换按品质降序 → uuid 升序循环(与图鉴页面卡片顺序一致)。
* - hero_icon 使用 Animation + iconVisualToken 机制防止异步加载竞态。
*
* 依赖:
* - HeroInfo / heroSet —— 英雄静态配置
* - getSortedHeroList(heroUpSet)—— 图鉴排序
* - HeroInfo / HeroList(heroSet)—— 英雄静态配置与全量 UUID 列表
* - smc.getHeroGrowth / smc.getHeroOuterLv / smc.upgradeHero —— 成长数据
* - buildHeroSkillDesc(HeroSkillText)—— 技能描述生成器
* - SSkillBoxComp / ChipComp / SmallTipComp —— 子组件
@@ -30,12 +29,11 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "db://oops-framework/core/Oops";
import { mLogger } from "../common/Logger";
import { HeroInfo, SkillTriggerType, LvFieldEntry, LvTriggerEntry, TriggerGrouped, HSkillInfo, getHeroDisplayStats, LvBonusAttrsEntry } from "../common/config/heroSet";
import { HeroInfo, HeroList, SkillTriggerType, LvFieldEntry, LvTriggerEntry, TriggerGrouped, HSkillInfo, getHeroDisplayStats, LvBonusAttrsEntry } from "../common/config/heroSet";
import { buildHeroSkillDesc } from "../common/HeroSkillText";
import { outlineRich } from "../common/RichOutline";
import { GameEvent } from "../common/config/GameEvent";
import { HERO_UPGRADE_NEED_FRAGMENTS, RARITY_BG_COLORS } from "../common/config/GameSet";
import { getSortedHeroList } from "../common/config/heroUpSet";
import { ChipComp } from "./ChipComp";
import { SmallTipComp } from "./SmallTipComp";
import { SSkillBoxComp } from "./SSkillBoxComp";
@@ -249,7 +247,13 @@ export class HeroInfoComp extends CCComp {
* @param delta 1 下一个,-1 上一个
*/
private switchHero(delta: 1 | -1) {
const sorted = getSortedHeroList(uuid => smc.getHeroGrowth(uuid));
// 与图鉴页面排序同源:仅按品质降序 → uuid 升序
const sorted = [...HeroList].sort((a, b) => {
const ra = HeroInfo[a]?.rarity ?? 1;
const rb = HeroInfo[b]?.rarity ?? 1;
if (ra !== rb) return rb - ra;
return a - b;
});
if (sorted.length === 0) return;
const idx = sorted.indexOf(this.huuid);
// 当前 uuid 不在列表中(异常)时回退到第一个

View File

@@ -5,15 +5,16 @@
* 职责:
* 1. 以卡片列表形式展示所有可用英雄(使用 CardLiteComp 预制体)。
* 2. 点击卡片打开英雄详情弹窗(UIID.HeroInfo),详情/升级在 HeroInfoComp 中处理。
* 3. 卡片排序:可升级优先 → 现有等级降序 → 品质降序(getSortedHeroList)。
* 3. 卡片排序:仅按品质降序 → uuid 升序(与养成进度解耦,保持展示稳定)。
*
* 关键设计:
* - cards_node 为卡片容器,通过 instantiate(card_lite_prefab) 动态生成卡片。
* - 升级/碎片变动后通过 HERO_GROWTH_UPDATE 事件统一刷新所有卡片的可升级标识。
* - 详情面板已从本组件剥离,由 HeroInfoComp 承载。
* - 排序不依赖 smc,仅读取静态配置(HeroInfo.rarity)。
*
* 依赖:
* - getSortedHeroList(heroUpSet)—— 图鉴排序
* - HeroInfo / HeroList(heroSet)—— 英雄静态配置与全量 UUID 列表
* - CardLiteComp —— 轻量卡片组件
* - UIID.HeroInfo(oops.gui)—— 英雄详情弹窗
*/
@@ -24,10 +25,8 @@ import { oops } from "db://oops-framework/core/Oops";
import { mLogger } from "../common/Logger";
import { HeroInfo, HeroList } from "../common/config/heroSet";
import { GameEvent } from "../common/config/GameEvent";
import { getSortedHeroList } from "../common/config/heroUpSet";
import { UIID } from "../common/config/GameUIConfig";
import { CardLiteComp } from "./CardLiteComp";
import { smc } from "../common/SingletonModuleComp";
const { property, ccclass } = _decorator;
@@ -46,14 +45,30 @@ export class HerosListComp extends CCComp {
@property
card_w = 120
/** 卡片高度 */
@property
card_h = 200
/** 卡片横向间隔 */
@property
spacing_x = 10
/** 卡片纵向间隔 */
@property
spacing_y = 10
/** 每行卡片数(竖向滚动时按列排列) */
@property
cols = 4
/** 卡片左右边距 */
@property
margin_x = 15
/** 卡片上下边距 */
@property
margin_y = 50
// ======================== 运行时状态 ========================
debugMode: boolean = false
@@ -95,8 +110,13 @@ export class HerosListComp extends CCComp {
this.cards_node.removeAllChildren()
// 排序与详情面板"前后切换"同源(getSortedHeroList),保证两个入口顺序一致
const sorted = getSortedHeroList(uuid => smc.getHeroGrowth(uuid))
// 图鉴排序:仅按品质降序 → uuid 升序(与养成进度解耦,保持展示稳定)
const sorted = [...HeroList].sort((a, b) => {
const ra = HeroInfo[a]?.rarity ?? 1;
const rb = HeroInfo[b]?.rarity ?? 1;
if (ra !== rb) return rb - ra;
return a - b;
})
for (const uuid of sorted) {
const hero = HeroInfo[uuid]
@@ -127,16 +147,18 @@ export class HerosListComp extends CCComp {
const total = this.cards_node.children.length
if (total === 0) return
// 宽度 = 卡片总宽 + 卡片间隔 + 左右边距
const contentW = total * this.card_w
+ (total - 1) * this.spacing_x
// 竖向滚动:宽度固定(每行 cols 列),高度按行数累计
const rows = Math.ceil(total / this.cols)
// 宽度 = 每行卡片总宽 + 横向间隔 + 左右边距
const contentW = this.cols * this.card_w
+ (this.cols - 1) * this.spacing_x
+ this.margin_x * 2
const cols = 4
const rows = Math.ceil(total / cols)
const cardH = 200
const spacingY = 10
const contentH = Math.max(1000, rows * (cardH + spacingY) + 50)
// 高度 = 行数 × 卡片高 + 纵向间隔 + 上下边距
const contentH = rows * this.card_h
+ (rows - 1) * this.spacing_y
+ this.margin_y * 2
const uiTrans = this.cards_node.getComponent(UITransform)
if (uiTrans) {

View File

@@ -69,6 +69,9 @@ export class TalentsComp extends CCComp {
@property({ type: ProgressBar, tooltip: "当前等级经验进度条" })
progress_exp: ProgressBar = null!;
@property({ type: Label, tooltip: "当前等级经验数值(当前经验/升级所需经验)" })
lbl_exp: Label = null!;
@property({ type: Node, tooltip: "一阶页签节点" })
tab_basic: Node = null!;
@@ -148,7 +151,14 @@ export class TalentsComp extends CCComp {
if (!this.talents_content || !this.prefab_talent_item) return;
const levels = smc.getTalentLevels();
if (this.lbl_points) this.lbl_points.string = `${smc.getTalentPoints()}`;
if (this.lbl_points) {
// 剩余/总点数:总点数 = 剩余 + 各阶已投入
const remaining = smc.getTalentPoints();
const invested = getTalentTierInvestedPoints(levels, TalentTier.Basic)
+ getTalentTierInvestedPoints(levels, TalentTier.Specialized)
+ getTalentTierInvestedPoints(levels, TalentTier.Super);
this.lbl_points.string = `${remaining}/${remaining + invested}`;
}
// 天赋等级(Lv.x)与当前等级经验进度
const talentLv = smc.getTalentLevel();
@@ -160,6 +170,13 @@ export class TalentsComp extends CCComp {
? Math.min(1, smc.getTalentExp() / needExp)
: 1;
}
if (this.lbl_exp) {
const needExp = getTalentLevelExp(talentLv);
// 满级后显示为 0/0,避免分母为 0
this.lbl_exp.string = needExp > 0
? `${smc.getTalentExp()}/${needExp}`
: `0/0`;
}
// 仅首次进入时默认选中已解锁的最高阶,后续刷新保持玩家当前选择
if (!this.inited) {