feat: 重构卡牌描述渲染系统,实现动态富文本展示

1. 新增SkillDescSet配置商店技能与药水模板,补充6201-6206范围攻击与6502-6511计时强化技能配置
2. 替换原有单/多文本标签为富文本组件,统一使用buildCardDescRich生成描述
3. 简化物品商店与卡牌组件的描述渲染逻辑,移除冗余的getDescription方法
4. 为药水卡片移除硬编码描述,改为从技能模板动态生成,自动高亮数值与持续时间
5. 实现附加概率后缀自动生成,支持暴击/冰冻/击晕/击退概率动态展示
This commit is contained in:
pan
2026-07-31 16:02:47 +08:00
parent f058d02ad9
commit a06c2c0e31
7 changed files with 1480 additions and 1104 deletions

View File

@@ -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