refactor(ui): 重构装备和英雄的词条展示逻辑
1. 替换单个Label词条为RichText多行展示 2. 统一使用buildEquipRich和buildSkillDescRich生成带高亮的词条文本 3. 调整prefab的UI元素尺寸适配新的富文本展示 4. 新增showName参数适配不同场景的技能名显示需求
This commit is contained in:
@@ -12,12 +12,12 @@
|
||||
* EquipBoxComp 按 Field 类型被动驻场,属性加成由 FieldSkillHelper 全局聚合。
|
||||
*/
|
||||
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 } from "../common/config/CardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { 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";
|
||||
@@ -50,15 +50,9 @@ export class EquipListComp 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;
|
||||
/** 属性词条富文本(多行,数值绿色高亮,由 buildEquipRich 按 FieldDescSet 实时渲染) */
|
||||
@property(RichText)
|
||||
private info_rich: RichText = null;
|
||||
|
||||
/** 等级标签 */
|
||||
@property(Label)
|
||||
@@ -161,19 +155,11 @@ export class EquipListComp 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 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;
|
||||
}
|
||||
// 属性词条富文本(多词条装备由 buildEquipRich 按 \n 多行渲染,数值实时高亮)
|
||||
if (this.info_rich) {
|
||||
const desc = buildEquipRich(this.cardData.field || []);
|
||||
this.info_rich.string = desc;
|
||||
this.info_rich.node.active = !!desc;
|
||||
}
|
||||
|
||||
// 图标(共享工具解析:cardData.icon → FieldSkillSet → SkillSet)
|
||||
|
||||
Reference in New Issue
Block a user