refactor: 重构技能弹窗系统,移除冗余技能池逻辑

1.  删除SkillBoxCardConfig相关类型、技能池配置和抽卡函数
2.  移除技能弹窗的刷新次数持久化逻辑与UI
3.  简化MissSkillsComp、SkillBoxComp的技能处理流程
4.  统一技能卡的添加和初始化逻辑,移除config专用初始化流程
5.  调整MissionCardComp的波次技能弹窗触发逻辑
6.  清理CardComp中冗余的技能描述缓存代码
7.  修正UIConfig中SkillBox预制体路径命名
This commit is contained in:
pan
2026-06-03 17:24:22 +08:00
parent e76cba7933
commit 27ffdaaf87
9 changed files with 39 additions and 573 deletions

View File

@@ -37,7 +37,6 @@ import { FieldSkillType } from "../common/config/SkillSet";
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
import { getLvColor } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy";
import { buildSkillDesc } from "../common/config/HeroSkillDesc";
@@ -95,9 +94,6 @@ export class CardComp extends CCComp {
@property(Node)
hp_node = null!
/** 技能信息标签缓存引用(由 cacheLabels 在 onLoad 时初始化) */
private infoLabel: Label | null = null;
// ======================== 运行时状态 ========================
/** 当前卡牌的金币费用 */
@@ -148,7 +144,6 @@ export class CardComp extends CCComp {
onLoad() {
/** 初始阶段只做UI状态准备不触发业务逻辑 */
this.bindEvents();
this.cacheLabels();
this.restPosition = this.node.position.clone();
this.opacityComp = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity);
this.opacityComp.opacity = 255;
@@ -705,8 +700,6 @@ export class CardComp extends CCComp {
this.hp_node.active = true;
// 英雄卡:隐藏技能信息节点
if (this.info_node) this.info_node.active = false;
// 英雄卡:清空技能描述文本,避免切回时残留上一次的技能信息
if (this.infoLabel) this.infoLabel.string = "";
} else if (this.card_type === CardType.Skill) {
if (this.lvl_node) this.lvl_node.node.active = false;
// 技能卡:显示技能名 + 品质后缀 + 描述
@@ -720,18 +713,6 @@ export class CardComp extends CCComp {
this.hp_node.active = false;
// 技能卡:显示技能信息节点
if (this.info_node) this.info_node.active = true;
// 技能卡:填充技能描述文本(沿用 HInfoComp.buildSkillDesc 模式)
// 注意:技能卡 uuid 来自 SkillSet 而非 HeroInfo故以 SkillConfig 作为数据源;
// 用 buildSkillDesc 兼容调用,结果为空时回退到 SkillConfig.info 字段
if (this.infoLabel) {
const skill = SkillSet[this.card_uuid];
if (skill) {
const desc = buildSkillDesc(skill as any) || skill.info || "";
this.infoLabel.string = desc;
} else {
this.infoLabel.string = "";
}
}
} else {
if (this.lvl_node) this.lvl_node.node.active = false;
// 特殊卡(升级 / 刷新):显示卡名 + 品质后缀 + 描述
@@ -744,8 +725,6 @@ export class CardComp extends CCComp {
this.ap_node.active = false;
this.hp_node.active = false;
// 特殊卡:清空技能描述文本,避免切到特殊卡时残留上一次的技能信息
if (this.infoLabel) this.infoLabel.string = "";
}
// ---- 费用标签 ----
@@ -927,25 +906,6 @@ export class CardComp extends CCComp {
if (label) label.string = value;
}
/**
* 缓存 info_node 子树中的 Label 引用。
* 与 HInfoComp.cacheLabels() 同源实现:若 info_node 下没有 Label 则动态创建,
* 并设置与 HInfoComp 一致的字号 / 行高 / 对齐 / 溢出策略。
*/
private cacheLabels() {
if (this.infoLabel || !this.info_node) return;
this.infoLabel = this.info_node.getComponentInChildren(Label);
if (!this.infoLabel) {
const child = this.info_node.children[0] || this.info_node;
this.infoLabel = child.getComponent(Label) || child.addComponent(Label);
this.infoLabel.fontSize = 20;
this.infoLabel.lineHeight = 28;
this.infoLabel.overflow = Label.Overflow.SHRINK;
this.infoLabel.horizontalAlign = Label.HorizontalAlign.LEFT;
this.infoLabel.verticalAlign = Label.VerticalAlign.TOP;
}
}
/**
* 根据卡牌类型和 UUID 解析出图标 ID在 SpriteAtlas 中的帧名)。