feat: 重构卡牌描述渲染系统,实现动态富文本展示
1. 新增SkillDescSet配置商店技能与药水模板,补充6201-6206范围攻击与6502-6511计时强化技能配置 2. 替换原有单/多文本标签为富文本组件,统一使用buildCardDescRich生成描述 3. 简化物品商店与卡牌组件的描述渲染逻辑,移除冗余的getDescription方法 4. 为药水卡片移除硬编码描述,改为从技能模板动态生成,自动高亮数值与持续时间 5. 实现附加概率后缀自动生成,支持暴击/冰冻/击晕/击退概率动态展示
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,7 @@ import { FieldSkillSet, mergeSkillParams, SkillConfig, SkillKind, SkillOverrides
|
||||
import { FieldDescSet, FieldValueFmt, SkillDescSet } from "./SkillDescSet";
|
||||
import { BuffList } from "./BuffSet";
|
||||
import { Attrs } from "./HeroAttrs";
|
||||
import { CardConfig } from "./CardSet";
|
||||
|
||||
/**
|
||||
* 生成器入参窄接口:只约束实际读取的字段。
|
||||
@@ -91,6 +92,9 @@ const RICH_NAME_COLOR = "#2E86C1";
|
||||
/** 技能名「」匹配模式(仅本模块行首/行中技能名片段使用) */
|
||||
const SKILL_NAME_PATTERN = /「([^」]*)」/g;
|
||||
|
||||
/** "持续X秒"匹配模式(卡片描述后处理:把持续时间数值也高亮) */
|
||||
const DURATION_PATTERN = /持续(\d+)秒/g;
|
||||
|
||||
/** 解析目标描述文本(与战斗 SCastSystem 目标选取语义严格一致) */
|
||||
function buildTargetDesc(skill: SkillConfig): string {
|
||||
switch (skill.TGroup) {
|
||||
@@ -374,3 +378,92 @@ export function buildEquipRich(fieldUuids: number[]): string {
|
||||
}
|
||||
return lines.length > 0 ? lines.join("\n") : "无词条";
|
||||
}
|
||||
|
||||
/**
|
||||
* 把"持续X秒"中的 X 也包裹绿色高亮(卡片描述后处理)。
|
||||
* Why: 计时模板 {dur} 不在 \x01\x02 高亮标记内,renderLineRich 仅高亮主数值;
|
||||
* 持续时间对药水/计时 buff 同样关键,这里补充高亮,保证视觉一致。
|
||||
*/
|
||||
function highlightDuration(text: string): string {
|
||||
return text.replace(DURATION_PATTERN, `持续<color=${RICH_VALUE_COLOR}>$1</color>秒`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结构化行 → 富文本串(技能名蓝色、数值绿色)。
|
||||
* buildEquipRich / buildCardDescRich 共用,保证渲染规则唯一。
|
||||
*/
|
||||
function renderLineRich(line: ISkillLine): string {
|
||||
const prefix = line.prefix.replace(SKILL_NAME_PATTERN, `「<color=${RICH_NAME_COLOR}>$1</color>」`);
|
||||
return line.value
|
||||
? `${prefix}<color=${RICH_VALUE_COLOR}>${line.value}</color>${line.suffix}`
|
||||
: `${prefix}${line.suffix}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描合并后技能的附加概率字段(crt/frz/stun/bck),非零的拼为高亮后缀。
|
||||
* Why: 模板不再硬编码"有概率击晕"等文案,由实际配置驱动,避免描述与数值漂移。
|
||||
* @returns 形如 ",30%击晕,20%冰冻";全为 0 时返回 ""
|
||||
*/
|
||||
function buildChanceSuffix(skill: SkillConfig): string {
|
||||
const items: string[] = [];
|
||||
const push = (val: number | undefined, label: string) => {
|
||||
if (val && val > 0) items.push(`附加<color=${RICH_VALUE_COLOR}>${val}</color>%${label}`);
|
||||
};
|
||||
push(skill.crt, "暴击");
|
||||
push(skill.frz, "冰冻");
|
||||
push(skill.stun, "击晕");
|
||||
push(skill.bck, "击退");
|
||||
return items.length > 0 ? `,${items.join(",")}` : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 商店卡片描述富文本(SCardComp / ItemListComp 用,BBCode)。
|
||||
*
|
||||
* Why: 卡片 info 为手写文案,与 SkillSet/BuffList 数值易漂移。
|
||||
* 本函数从 CardConfig.skill + overrides 合并后的实时配置生成描述,
|
||||
* 数值随档位(如高级药水 buff_value)自动同步,数值绿色高亮、技能名蓝色。
|
||||
*
|
||||
* 描述规则:
|
||||
* - 药品/技能卡(card.skill 有效)→ 查 SkillDescSet 模板渲染(计时模式取 BuffList 默认值兜底);
|
||||
* 未入表技能回退 SkillSet.info / card.info,整行不高亮。
|
||||
* - 装备卡(card.field 有效)→ 复用 buildEquipRich 逐词条渲染。
|
||||
* - 触发节奏(t_times/t_inv)融入单行描述:定时触发"每M秒释放一次「技能名」,xxx,共N次";即时触发仅显示效果。
|
||||
*
|
||||
* @param card 卡片配置(SCardSet 技能卡 / ICardSet 药品卡 / EquipSet 装备卡)
|
||||
* @returns 多行富文本串;无可描述内容时回退 card.info
|
||||
*/
|
||||
export function buildCardDescRich(card: CardConfig): string {
|
||||
// 装备卡:逐词条渲染驻场光环
|
||||
if (card.field && card.field.length > 0) {
|
||||
return buildEquipRich(card.field);
|
||||
}
|
||||
|
||||
// 药品/技能卡:合并覆写后按 SkillDescSet 模板渲染
|
||||
const base = card.skill ? SkillSet[card.skill] : undefined;
|
||||
if (base) {
|
||||
const skill = mergeSkillParams(base, card.overrides);
|
||||
const line = buildEffectLine("", skill);
|
||||
// 未入表技能回退链:SkillSet.info → card.info
|
||||
if (!line.value && !SkillDescSet[skill.uuid]) {
|
||||
return String(skill.info || card.info || "");
|
||||
}
|
||||
|
||||
// 触发节奏融入描述:定时触发"每M秒释放一次「技能名」,xxx,共N次";即时触发直接描述
|
||||
const tTimes = card.t_times ?? 1;
|
||||
const tInv = card.t_inv ?? 0;
|
||||
const isInstant = card.is_inst || tInv <= 0;
|
||||
// 附加概率后缀(暴击/冰冻/击晕/击退),由实际配置驱动
|
||||
const suffix = buildChanceSuffix(skill);
|
||||
const rich = highlightDuration(renderLineRich(line)) + suffix;
|
||||
|
||||
if (isInstant) {
|
||||
return rich;
|
||||
}
|
||||
|
||||
const rhythm = `每<color=${RICH_VALUE_COLOR}>${tInv}</color>秒释放一次「<color=${RICH_NAME_COLOR}>${skill.name}</color>」`;
|
||||
const times = `,共<color=${RICH_VALUE_COLOR}>${tTimes}</color>次`;
|
||||
return `${rhythm},${rich}${times}`;
|
||||
}
|
||||
|
||||
return card.info || "";
|
||||
}
|
||||
|
||||
@@ -33,24 +33,24 @@ interface ItemCardRaw {
|
||||
|
||||
const ItemCardData: ItemCardRaw[] = [
|
||||
// ==================== 一次性回血(计时性 HoT,5s) ====================
|
||||
{ uuid: 9101, skill: 6502, icon: "Sub_Item-FA_WP_Sub_Potion_001_Green", name: "再生药水", info: "全体友方每秒回复生命,持续 5 秒", cost: 0, weight: 20 },
|
||||
{ uuid: 9101, skill: 6502, icon: "Sub_Item-FA_WP_Sub_Potion_001_Green", name: "再生药水", info: "全体友方持续回复生命", cost: 0, weight: 20 },
|
||||
|
||||
// ==================== 计时性强化(统一 5s) ====================
|
||||
{ uuid: 9102, skill: 6503, icon: "Sub_Item-FA_WP_Sub_Potion_001_Red", name: "攻击药水", info: "全体友方攻击力提升 50%,持续 5 秒", cost: 0, weight: 15 },
|
||||
{ uuid: 9103, skill: 6504, icon: "Sub_Item-FA_WP_Sub_Potion_001_Yellow", name: "暴击药水", info: "全体友方暴击率提升 30%,持续 5 秒", cost: 0, weight: 15 },
|
||||
{ uuid: 9104, skill: 6505, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "击退药水", info: "全体友方击退概率提升 30%,持续 5 秒", cost: 0, weight: 12 },
|
||||
{ uuid: 9105, skill: 6506, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "穿透药水", info: "全体友方穿透概率提升 30%,持续 5 秒", cost: 0, weight: 12 },
|
||||
{ uuid: 9106, skill: 6507, icon: "Sub_Item-FA_WP_Sub_Potion_001_Red", name: "攻速药水", info: "全体友方攻击速度提升 40%,持续 5 秒", cost: 0, weight: 15 },
|
||||
{ uuid: 9107, skill: 6508, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "风怒药水", info: "全体友方风怒概率提升 20%,持续 5 秒", cost: 0, weight: 12 },
|
||||
{ uuid: 9108, skill: 6509, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "击晕药水", info: "全体友方击晕概率提升 30%,持续 5 秒", cost: 0, weight: 12 },
|
||||
{ uuid: 9109, skill: 6510, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "击晕抗性药水", info: "全体友方击晕抗性提升 50%,持续 5 秒", cost: 4, weight: 10 },
|
||||
{ uuid: 9110, skill: 6511, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "冰冻抗性药水", info: "全体友方冰冻抗性提升 50%,持续 5 秒", cost: 4, weight: 10 },
|
||||
{ uuid: 9102, skill: 6503, icon: "Sub_Item-FA_WP_Sub_Potion_001_Red", name: "攻击药水", info: "全体友方攻击力提升", cost: 0, weight: 15 },
|
||||
{ uuid: 9103, skill: 6504, icon: "Sub_Item-FA_WP_Sub_Potion_001_Yellow", name: "暴击药水", info: "全体友方暴击率提升", cost: 0, weight: 15 },
|
||||
{ uuid: 9104, skill: 6505, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "击退药水", info: "全体友方击退概率提升", cost: 0, weight: 12 },
|
||||
{ uuid: 9105, skill: 6506, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "穿透药水", info: "全体友方穿透概率提升", cost: 0, weight: 12 },
|
||||
{ uuid: 9106, skill: 6507, icon: "Sub_Item-FA_WP_Sub_Potion_001_Red", name: "攻速药水", info: "全体友方攻击速度提升", cost: 0, weight: 15 },
|
||||
{ uuid: 9107, skill: 6508, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "风怒药水", info: "全体友方风怒概率提升", cost: 0, weight: 12 },
|
||||
{ uuid: 9108, skill: 6509, icon: "Sub_Item-FA_WP_Sub_Potion_001_Purple", name: "击晕药水", info: "全体友方击晕概率提升", cost: 0, weight: 12 },
|
||||
{ uuid: 9109, skill: 6510, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "击晕抗性药水", info: "全体友方击晕抗性提升", cost: 4, weight: 10 },
|
||||
{ uuid: 9110, skill: 6511, icon: "Sub_Item-FA_WP_Sub_Potion_001_Blue", name: "冰冻抗性药水", info: "全体友方冰冻抗性提升", cost: 4, weight: 10 },
|
||||
|
||||
// ==================== 高级档(buff_value 覆写,复用同一技能底座) ====================
|
||||
{ uuid: 9201, skill: 6502, icon: "Sub_Item-FA_WP_Sub_Potion_002_Green", name: "高级再生药水", info: "全体友方每秒回复 25 生命,持续 5 秒", cost: 0, weight: 8, overrides: { buff_value: 25 } },
|
||||
{ uuid: 9202, skill: 6503, icon: "Sub_Item-FA_WP_Sub_Potion_002_Red", name: "高级攻击药水", info: "全体友方攻击力提升 80%,持续 5 秒", cost: 0, weight: 8, overrides: { buff_value: 80 } },
|
||||
{ uuid: 9203, skill: 6504, icon: "Sub_Item-FA_WP_Sub_Potion_002_Yellow", name: "高级暴击药水", info: "全体友方暴击率提升 50%,持续 5 秒", cost: 0, weight: 8, overrides: { buff_value: 50 } },
|
||||
{ uuid: 9206, skill: 6507, icon: "Sub_Item-FA_WP_Sub_Potion_002_Red", name: "高级攻速药水", info: "全体友方攻击速度提升 70%,持续 5 秒", cost: 0, weight: 8, overrides: { buff_value: 70 } },
|
||||
{ uuid: 9201, skill: 6502, icon: "Sub_Item-FA_WP_Sub_Potion_002_Green", name: "高级再生药水", info: "全体友方持续回复生命", cost: 0, weight: 8, overrides: { buff_value: 25 } },
|
||||
{ uuid: 9202, skill: 6503, icon: "Sub_Item-FA_WP_Sub_Potion_002_Red", name: "高级攻击药水", info: "全体友方攻击力提升", cost: 0, weight: 8, overrides: { buff_value: 80 } },
|
||||
{ uuid: 9203, skill: 6504, icon: "Sub_Item-FA_WP_Sub_Potion_002_Yellow", name: "高级暴击药水", info: "全体友方暴击率提升", cost: 0, weight: 8, overrides: { buff_value: 50 } },
|
||||
{ uuid: 9206, skill: 6507, icon: "Sub_Item-FA_WP_Sub_Potion_002_Red", name: "高级攻速药水", info: "全体友方攻击速度提升", cost: 0, weight: 8, overrides: { buff_value: 70 } },
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,6 +99,86 @@ export const SkillDescSet: Record<number, SkillDescConfig> = {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "{target}以{value}%生命复活",
|
||||
},
|
||||
|
||||
// ==================== 技能商店范围攻击卡(6201-6206):ap = 单段伤害 ====================
|
||||
// 注:暴击/冰冻/击晕/击退等附加概率由 buildCardDescRich 扫描 crt/frz/stun/bck 动态追加,不在模板写死
|
||||
6201: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
6202: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
6203: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
6204: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
6205: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
6206: {
|
||||
verb: "", unit: "", permField: "ap",
|
||||
templPerm: "每段造成{value}点伤害",
|
||||
},
|
||||
|
||||
// ==================== 计时性强化技能(6502-6511,药水底座,走 timed_buff_id) ====================
|
||||
// 数值取自 BuffList 默认修饰值或药水卡 overrides.buff_value,持续时间取 BuffList.duration
|
||||
6502: {
|
||||
verb: "", unit: "", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}回复生命",
|
||||
templTimed: "{target}每秒回复{value}点生命,持续{dur}秒",
|
||||
},
|
||||
6503: {
|
||||
verb: "攻击力提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6504: {
|
||||
verb: "暴击率提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6505: {
|
||||
verb: "击退概率提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6506: {
|
||||
verb: "穿透概率提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6507: {
|
||||
verb: "攻击速度提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6508: {
|
||||
verb: "风怒概率提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6509: {
|
||||
verb: "击晕概率提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6510: {
|
||||
verb: "击晕抗性提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
6511: {
|
||||
verb: "冰冻抗性提升", unit: "%", permField: "ap", timedField: "buff_value",
|
||||
templPerm: "{target}{verb}{value}{unit}",
|
||||
templTimed: "{target}{verb}{value}{unit},持续{dur}秒",
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* 本组件同时服务于装备商店和商品商店,通过 cardData 的 trigger_type / kind 自动判断类型。
|
||||
*/
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Node, Label, NodeEventType, Vec3, UIOpacity, tween, Tween } from "cc";
|
||||
import { _decorator, Node, Label, RichText, NodeEventType, Vec3, UIOpacity, tween, Tween } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { CardConfig, CardTriggerType, CKind } from "../common/config/CardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { buildCardDescRich, buildEquipRich } from "../common/config/HeroSkillDesc";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -52,15 +52,9 @@ export class ItemListComp extends CCComp {
|
||||
@property(Label)
|
||||
private name_label: Label = null;
|
||||
|
||||
/** 描述/属性词条 1 */
|
||||
@property(Label)
|
||||
private fied1: Label = null;
|
||||
/** 描述/属性词条 2 */
|
||||
@property(Label)
|
||||
private fied2: Label = null;
|
||||
/** 描述/属性词条 3 */
|
||||
@property(Label)
|
||||
private fied3: Label = null;
|
||||
/** 描述/属性词条富文本(多行,数值绿色高亮、技能名蓝色) */
|
||||
@property(RichText)
|
||||
private info_rich: RichText = null;
|
||||
|
||||
/** 等级标签 */
|
||||
@property(Label)
|
||||
@@ -169,42 +163,18 @@ export class ItemListComp extends CCComp {
|
||||
// 背景:按 card_lv 激活对应颜色子节点(1→green 2→blue 3→purple 4→red 5→yellow)
|
||||
this.updateBgNode();
|
||||
|
||||
// 描述/属性词条(最多显示 3 条)
|
||||
const fieldLabels = [this.fied1, this.fied2, this.fied3];
|
||||
if (isEquip) {
|
||||
// 装备:显示 field 词条
|
||||
const fields = this.cardData.field || [];
|
||||
for (let i = 0; i < fieldLabels.length; i++) {
|
||||
if (!fieldLabels[i]) continue;
|
||||
if (i < fields.length) {
|
||||
const fieldConfig = FieldSkillSet[fields[i]];
|
||||
fieldLabels[i].string = fieldConfig?.info || "";
|
||||
fieldLabels[i].node.active = true;
|
||||
} else {
|
||||
fieldLabels[i].string = "";
|
||||
fieldLabels[i].node.active = false;
|
||||
}
|
||||
}
|
||||
} else if (isPotion) {
|
||||
// 商品:仅显示卡牌 info
|
||||
const cardInfo = this.cardData.info || "";
|
||||
|
||||
if (fieldLabels[0]) {
|
||||
fieldLabels[0].string = cardInfo;
|
||||
fieldLabels[0].node.active = !!cardInfo;
|
||||
}
|
||||
for (let i = 1; i < fieldLabels.length; i++) {
|
||||
if (!fieldLabels[i]) continue;
|
||||
fieldLabels[i].string = "";
|
||||
fieldLabels[i].node.active = false;
|
||||
}
|
||||
} else {
|
||||
// 其他类型:显示 info
|
||||
for (let i = 0; i < fieldLabels.length; i++) {
|
||||
if (!fieldLabels[i]) continue;
|
||||
fieldLabels[i].string = i === 0 ? (this.cardData.info || "") : "";
|
||||
fieldLabels[i].node.active = i === 0 && !!this.cardData.info;
|
||||
// 描述/属性词条富文本(装备逐词条多行;药品/技能卡数值随 overrides 档位自动同步)
|
||||
if (this.info_rich) {
|
||||
let desc = "";
|
||||
if (isEquip) {
|
||||
desc = buildEquipRich(this.cardData.field || []);
|
||||
} else if (isPotion) {
|
||||
desc = buildCardDescRich(this.cardData);
|
||||
} else {
|
||||
desc = this.cardData.info || "";
|
||||
}
|
||||
this.info_rich.string = desc;
|
||||
this.info_rich.node.active = !!desc;
|
||||
}
|
||||
|
||||
// 图标(共享工具解析:cardData.icon → FieldSkillSet)
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
* 由 MissSkillsComp 接收并创建 SBox 实体 / SkillBoxComp 执行技能逻辑。
|
||||
*/
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Node, Sprite, Label, NodeEventType, Vec3, UIOpacity, tween, Tween } from "cc";
|
||||
import { _decorator, Node, Sprite, Label, RichText, NodeEventType, Vec3, UIOpacity, tween, Tween } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { CardConfig } from "../common/config/CardSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { FieldSkillSet, SkillSet, SkillConfig } from "../common/config/SkillSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { buildCardDescRich } from "../common/config/HeroSkillDesc";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -50,15 +51,9 @@ export class SCardComp extends CCComp {
|
||||
@property(Label)
|
||||
private name_label: Label = null;
|
||||
|
||||
/** 描述词条 1 */
|
||||
@property(Label)
|
||||
private fied1: Label = null;
|
||||
/** 描述词条 2 */
|
||||
@property(Label)
|
||||
private fied2: Label = null;
|
||||
/** 描述词条 3 */
|
||||
@property(Label)
|
||||
private fied3: Label = null;
|
||||
/** 描述富文本(多行,数值绿色高亮、技能名蓝色,由 buildCardDescRich 生成) */
|
||||
@property(RichText)
|
||||
private info_rich: RichText = null;
|
||||
|
||||
/** 等级标签 */
|
||||
@property(Label)
|
||||
@@ -165,12 +160,9 @@ export class SCardComp extends CCComp {
|
||||
|
||||
if (this.name_label) this.name_label.string = "";
|
||||
if (this.level_label) this.level_label.string = "";
|
||||
const fieldLabels = [this.fied1, this.fied2, this.fied3];
|
||||
for (const label of fieldLabels) {
|
||||
if (label) {
|
||||
label.string = "";
|
||||
label.node.active = false;
|
||||
}
|
||||
if (this.info_rich) {
|
||||
this.info_rich.string = "";
|
||||
this.info_rich.node.active = false;
|
||||
}
|
||||
if (this.icon_node) {
|
||||
const sprite = this.icon_node.getComponent(Sprite) || this.icon_node.getComponentInChildren(Sprite);
|
||||
@@ -204,13 +196,11 @@ export class SCardComp extends CCComp {
|
||||
// 背景:按 card_lv 激活对应颜色子节点(1→green 2→blue 3→purple 4→red 5→yellow)
|
||||
this.updateBgNode();
|
||||
|
||||
// 描述词条(最多显示 3 条,对应 fied1/fied2/fied3)
|
||||
const fieldLabels = [this.fied1, this.fied2, this.fied3];
|
||||
const desc = this.getDescription(skillCard, skill);
|
||||
for (let i = 0; i < fieldLabels.length; i++) {
|
||||
if (!fieldLabels[i]) continue;
|
||||
fieldLabels[i].string = i === 0 ? desc : "";
|
||||
fieldLabels[i].node.active = i === 0 && !!desc;
|
||||
// 描述富文本(数值随 overrides 档位自动同步高亮)
|
||||
if (this.info_rich) {
|
||||
const desc = buildCardDescRich(this.cardData);
|
||||
this.info_rich.string = desc;
|
||||
this.info_rich.node.active = !!desc;
|
||||
}
|
||||
|
||||
// 图标(共享工具解析:cardData.icon → FieldSkillSet → SkillSet)
|
||||
@@ -358,15 +348,6 @@ export class SCardComp extends CCComp {
|
||||
.start();
|
||||
}
|
||||
|
||||
/** 获取技能描述:驻场技能取 FieldSkillSet,其余取技能/卡牌配置 */
|
||||
private getDescription(skillCard: CardConfig | undefined, skill: SkillConfig | null): string {
|
||||
if (!this.cardData) return "";
|
||||
if (this.cardData.field && this.cardData.field.length > 0) {
|
||||
return FieldSkillSet[this.cardData.field[0]]?.info || "";
|
||||
}
|
||||
return skillCard?.info || skill?.info || this.cardData.info || "";
|
||||
}
|
||||
|
||||
// ======================== 购买逻辑 ========================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user