feat: 重构卡牌描述渲染系统,实现动态富文本展示
1. 新增SkillDescSet配置商店技能与药水模板,补充6201-6206范围攻击与6502-6511计时强化技能配置 2. 替换原有单/多文本标签为富文本组件,统一使用buildCardDescRich生成描述 3. 简化物品商店与卡牌组件的描述渲染逻辑,移除冗余的getDescription方法 4. 为药水卡片移除硬编码描述,改为从技能模板动态生成,自动高亮数值与持续时间 5. 实现附加概率后缀自动生成,支持暴击/冰冻/击晕/击退概率动态展示
This commit is contained in:
@@ -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