feat: 完成天赋系统重做与UI界面优化

1.  新增天赋等级配置与经验升级逻辑,支持连升多级
2.  重构天赋UI界面,添加等级进度条与页签状态显示
3.  优化技能卡片UI,新增技能名称显示与等级格式调整
4.  调整英雄界面布局,修复UI错位问题
5.  新增页签背景预制件与天赋道具UI样式
This commit is contained in:
panFD
2026-08-26 08:50:54 +08:00
parent 93a3c69d22
commit 5b965bba60
13 changed files with 9888 additions and 6078 deletions

View File

@@ -30,6 +30,10 @@ export class SSkillBoxComp extends CCComp {
@property(Label)
private lv_label: Label = null;
/** 技能名称标签 */
@property(Label)
private name_label: Label = null;
/** 锁定遮罩节点(active 时表示技能未激活) */
@property({ type: Node })
private locked: Node = null;
@@ -40,6 +44,8 @@ export class SSkillBoxComp extends CCComp {
private card_lv: number = 1;
/** 卡牌自定义图标ID(优先级最高,未定义则按 trigger_type 自动取) */
private card_icon?: string;
/** 技能名称(装备卡取卡牌名,英雄图鉴取技能名) */
private skill_name: string = "";
/** 触发类型(默认即时,保持向后兼容) */
private trigger_type: CardTriggerType = CardTriggerType.Instant;
/** 驻场技能词条列表(uuid 指向 FieldSkillSet 底座,value 为生效数值) */
@@ -64,8 +70,10 @@ export class SSkillBoxComp extends CCComp {
this.s_uuid = config.skill ?? uuid; // 获取实际的技能 UUID
this.card_icon = config.icon; // 保存卡牌自定义图标(优先级最高)
this.trigger_type = config.trigger_type ?? CardTriggerType.Instant;
this.skill_name = config.name ?? "";
} else {
this.s_uuid = uuid;
this.skill_name = "";
}
this.updateUI();
@@ -89,13 +97,16 @@ export class SSkillBoxComp extends CCComp {
/**
* 设置技能激活状态:
* - locked = true → 显示锁定遮罩,技能未激活
* - locked = false → 隐藏锁定遮罩,技能已激活
* - locked = true → 显示锁定遮罩,技能未激活(隐藏等级标签)
* - locked = false → 隐藏锁定遮罩,技能已激活(恢复等级标签)
*/
setLocked(locked: boolean) {
if (this.locked) {
this.locked.active = locked;
}
if (this.lv_label) {
this.lv_label.node.active = !locked;
}
}
/**
@@ -119,11 +130,34 @@ export class SSkillBoxComp extends CCComp {
});
}
/**
* 解析技能名称:
* 优先取显式设置的卡牌名;否则按图标来源从 SkillSet / FieldSkillSet 取技能名。
*/
private resolveSkillName(): string {
if (this.skill_name) return this.skill_name;
if (this.hero_icon_source === "field") {
return this.s_uuid ? (FieldSkillSet[this.s_uuid]?.name ?? "") : "";
}
if (this.hero_icon_source === "skill") {
return this.s_uuid ? (SkillSet[this.s_uuid]?.name ?? "") : "";
}
if (this.trigger_type === CardTriggerType.Interval) {
return this.s_uuid ? (SkillSet[this.s_uuid]?.name ?? "") : "";
}
if (this.trigger_type === CardTriggerType.Field) {
const fieldUuid = this.field?.[0]?.uuid;
return fieldUuid ? (FieldSkillSet[fieldUuid]?.name ?? "") : "";
}
return "";
}
/**
* 更新 UI:
* - 背景:根据技能等级切换对应颜色子节点显示
* - 图标:从 uicons 图集获取
* - 等级标签:显示技能卡等级
* - 名称标签:显示技能名称
* - 等级标签:显示技能等级(Lv.x 样式)
*/
updateUI() {
// 按技能等级切换背景颜色节点(与 getLvColor 等级配色一致)
@@ -158,9 +192,14 @@ export class SSkillBoxComp extends CCComp {
}
}
// 显示技能等级
// 显示技能名称
if (this.name_label) {
this.name_label.string = this.resolveSkillName();
}
// 显示技能等级(Lv.x 样式)
if (this.lv_label) {
this.lv_label.string = `${this.card_lv}`;
this.lv_label.string = `Lv.${this.card_lv}`;
}
}