refactor(skill-text): 重构技能文案系统,拆分英雄/卡牌语境
1. 将原HeroSkillDesc拆分为CardSkillText(卡牌/道具通用)和HeroSkillText(英雄专属) 2. 移除废弃的HeroSkillDesc文件与相关引用 3. 统一技能文案生成逻辑,修复数值漂移问题 4. 调整英雄配置中技能解锁等级与分档规则 5. 优化技能弹窗UI与参数传递逻辑
This commit is contained in:
@@ -17,7 +17,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { CardConfig } from "../common/config/CardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { buildEquipRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildEquipRich } from "../common/config/CardSkillText";
|
||||
import { outlineRich } from "../common/RichOutline";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
|
||||
@@ -22,7 +22,7 @@ import { HeroInfo, calcGrowBonus } from "../common/config/heroSet";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { FacSet, FightSet, getLvColor, NumberFormatter } from "../common/config/GameSet";
|
||||
import { buildSkillDescMoreRich, ISkillDescSource } from "../common/config/HeroSkillDesc";
|
||||
import { buildHeroSkillDesc } from "../common/HeroSkillText";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroMoreCom } from "./HeroMoreCom";
|
||||
@@ -200,9 +200,9 @@ export class HeroBoxComp extends CCComp {
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建升级前后对比富文本(当前能力 vs 升级后能力)。
|
||||
* 数据源取 HeroInfo 静态配置,分别按当前 lv 与 nextLv 渲染同一份技能描述,
|
||||
* 与英雄信息弹窗(buildSkillDescMoreRich)同一套文案规则,杜绝数值漂移。
|
||||
* 构建升级前后对比富文本(当前属性/能力 vs 升级后属性/能力)。
|
||||
* 技能描述统一按局外等级口径渲染(buildHeroSkillDesc),与英雄信息弹窗同一套
|
||||
* 文案规则;战斗内升级不改变局外等级,故技能段前后一致,仅属性段随等级变化。
|
||||
*
|
||||
* @param heroLv 当前英雄等级
|
||||
* @param nextLv 目标等级
|
||||
@@ -212,21 +212,6 @@ export class HeroBoxComp extends CCComp {
|
||||
const hero = HeroInfo[this.model?.hero_uuid ?? 0];
|
||||
if (!hero) return "";
|
||||
|
||||
const buildSource = (lv: number): ISkillDescSource => ({
|
||||
lv: lv,
|
||||
skills: hero.skills,
|
||||
call: hero.call,
|
||||
dead: hero.dead,
|
||||
fstart: hero.fstart,
|
||||
atking: hero.atking,
|
||||
atked: hero.atked,
|
||||
field: hero.field,
|
||||
revive: hero.revive,
|
||||
grow_type: hero.grow_type,
|
||||
ap: hero.ap,
|
||||
hp: hero.hp,
|
||||
});
|
||||
|
||||
// ---- 属性成长(固定基础值 + 成长类型指数递增 + 一次性加成) ----
|
||||
const attrLine = (lv: number): string => {
|
||||
const grow = calcGrowBonus(hero, lv);
|
||||
@@ -235,9 +220,10 @@ export class HeroBoxComp extends CCComp {
|
||||
return `攻击 <color=#27AE60>${ap}</color> 生命 <color=#27AE60>${hp}</color>`;
|
||||
};
|
||||
|
||||
// ---- 升级前后能力对比(当前 vs 升级后,同一份文案规则按 lv 渲染) ----
|
||||
const curDesc = buildSkillDescMoreRich(buildSource(heroLv));
|
||||
const nextDesc = buildSkillDescMoreRich(buildSource(nextLv));
|
||||
// ---- 升级前后能力对比(局外等级口径,战斗内升级技能段不变) ----
|
||||
const skillDesc = buildHeroSkillDesc(hero.uuid);
|
||||
const curDesc = skillDesc;
|
||||
const nextDesc = skillDesc;
|
||||
|
||||
return `<outline color=#000000 width=2>` + [
|
||||
`<b>当前 Lv.${heroLv}:</b>`,
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
*
|
||||
* 依赖:
|
||||
* - HeroAttrsComp —— 英雄属性数据模型
|
||||
* - HeroSkillDesc —— 技能描述富文本标准层
|
||||
* - HeroSkillText —— 技能描述富文本标准层(局外等级口径)
|
||||
*/
|
||||
import { _decorator, Component, Label, NodeEventType, RichText } from "cc";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { buildSkillDescMoreRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildHeroSkillDesc } from "../common/HeroSkillText";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -175,7 +175,7 @@ export class HeroMoreCom extends Component {
|
||||
this.setStatRow(this.crt_all_label, this.crt_plus_label, finalCrit, finalCrit - (this.model.critical ?? 0), "%");
|
||||
|
||||
const finalCritDmg = this.model.getFinalCritDamage();
|
||||
this.setStatRow(this.crit_dmg_all_label, this.crit_dmg_plus_label, finalCritDmg, finalCritDmg - (this.model.crit_damage ?? 0), "%");
|
||||
this.setStatRow(this.crit_dmg_all_label, this.crit_dmg_plus_label, finalCritDmg, finalCritDmg - (this.model.critical_damage ?? 0), "%");
|
||||
|
||||
// ---- 冰冻率 / 击退强化 / 穿透率 ----
|
||||
const finalFreeze = this.model.getFinalFreezeChance();
|
||||
@@ -195,7 +195,7 @@ export class HeroMoreCom extends Component {
|
||||
// ---- 技能描述(技能名+技能等级 Lv.x,附升级提示 Lv.x→Lv.y 金色预览) ----
|
||||
if (this.skill_label && this.skill_label.isValid) {
|
||||
// 缓存未变则跳过重设,避免降频内 RichText 重复重解析排版
|
||||
const desc = buildSkillDescMoreRich(this.model);
|
||||
const desc = buildHeroSkillDesc(this.model.hero_uuid);
|
||||
if (desc !== this.skillDescCache) {
|
||||
this.skillDescCache = desc;
|
||||
this.skill_label.string = desc;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* 依赖:
|
||||
* - HeroInfo / HeroList(heroSet)—— 英雄静态配置与全量 UUID 列表
|
||||
* - CardLiteComp —— 轻量卡片组件
|
||||
* - buildSkillDesc(HeroSkillDesc)—— 技能描述生成器
|
||||
* - buildHeroSkillDesc(HeroSkillText)—— 技能描述生成器(局外等级口径)
|
||||
*/
|
||||
import { _decorator, Animation, AnimationClip, Button, Label, Node, Prefab, Sprite, UITransform, Vec3, Widget, instantiate, resources, tween, Tween } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
@@ -23,7 +23,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { HeroInfo, HeroList, SkillTriggerType, LvFieldEntry, LvReviveEntry, LvTriggerEntry, TriggerGrouped } from "../common/config/heroSet";
|
||||
import { buildSkillDesc } from "../common/config/HeroSkillDesc";
|
||||
import { buildHeroSkillDesc } from "../common/HeroSkillText";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HERO_UPGRADE_NEED_FRAGMENTS, CARD_LV_BG_COLORS } from "../common/config/GameSet";
|
||||
import { CardLiteComp } from "./CardLiteComp";
|
||||
@@ -405,7 +405,8 @@ export class HerosListComp extends CCComp {
|
||||
this.updateCdDisplay(hero)
|
||||
|
||||
if (this.info_node) {
|
||||
const desc = buildSkillDesc(hero)
|
||||
// Label 承载:HeroSkillText 输出富文本,剥离 BBCode 标签转纯文本
|
||||
const desc = buildHeroSkillDesc(hero.uuid, true, true).replace(/<[^>]+>/g, "")
|
||||
const infoLabel = this.info_node.getChildByName("info")?.getComponent(Label)
|
||||
|| this.info_node.getComponent(Label)
|
||||
|| this.info_node.getComponentInChildren(Label)
|
||||
@@ -518,7 +519,7 @@ export class HerosListComp extends CCComp {
|
||||
|
||||
// ---- 大招:skills[1] 及以后(英雄出场即激活,与能量条同语义,恒不锁定) ----
|
||||
Object.values(hero.skills).slice(1).forEach(hSkill => {
|
||||
// 技能等级展示与 buildSkillDesc 同规则:lv_entries 取 ≤lv 最大档的 s_lv,无生效档回退配置 lv
|
||||
// 技能等级展示与 HeroSkillText 取档同规则:lv_entries 取 ≤lv 最大档的 s_lv,无生效档回退配置 lv
|
||||
const sLv = hSkill.lv_entries?.length
|
||||
? (hSkill.lv_entries.filter(e => e.lv <= lv).pop()?.s_lv ?? hSkill.lv)
|
||||
: hSkill.lv
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
* 4. 点击弹窗任意区域关闭自身。
|
||||
*
|
||||
* 关键设计:
|
||||
* - 复用 HeroSkillDesc 的结构化模板渲染,数值实时从配置读取,杜绝漂移。
|
||||
* - 复用 CardSkillText 的结构化模板渲染,数值实时从配置读取,杜绝漂移。
|
||||
* - 技能:展示名称、等级、CD、效果描述(SkillDescSet 模板)。
|
||||
* - 装备:展示名称、全部驻场光环词条(FieldDescSet 模板)。
|
||||
* - 不走 oops.gui,由调用方手动实例化并添加到场景,通过 init() 初始化。
|
||||
*
|
||||
* 依赖:
|
||||
* - HeroSkillDesc(buildSingleSkillRich / buildEquipRich)—— 描述生成
|
||||
* - CardSkillText(buildSingleSkillRich / buildEquipRich)—— 描述生成
|
||||
* - SkillSet / FieldSkillSet(SkillSet)—— 技能/光环静态配置
|
||||
* - EquipSet(findEquipByUuid)—— 装备静态配置
|
||||
*/
|
||||
@@ -23,7 +23,7 @@ import { _decorator, Node, NodeEventType, RichText, UITransform, Widget } from "
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { SkillSet, SkillOverrides } from "../common/config/SkillSet";
|
||||
import { buildEquipRich, buildSingleSkillRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildEquipRich, buildSingleSkillRich } from "../common/config/CardSkillText";
|
||||
import { findEquipByUuid } from "../common/config/EquipSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
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 { buildCardDescRich, buildEquipRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildCardDescRich, buildEquipRich } from "../common/config/CardSkillText";
|
||||
import { outlineRich } from "../common/RichOutline";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
|
||||
@@ -17,7 +17,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { CardConfig } from "../common/config/CardSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { buildCardDescRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildCardDescRich } from "../common/config/CardSkillText";
|
||||
import { outlineRich } from "../common/RichOutline";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { CardTriggerType } from "../common/config/CardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { SkillSet, FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { FieldEntry } from "../common/config/heroSet";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
@@ -13,8 +12,8 @@ const { ccclass, property } = _decorator;
|
||||
/**
|
||||
* 技能小图标组件
|
||||
*
|
||||
* 由 MissSkillsComp.addSkill() 实例化并初始化。
|
||||
* 在战场上以图标 + 剩余次数的形式呈现。
|
||||
* 由英雄图鉴面板(HerosListComp.addSkillIcon)实例化,
|
||||
* 以图标 + 技能等级 + 锁定遮罩的形式展示英雄技能,点击弹出技能信息框。
|
||||
*/
|
||||
@ccclass('SSkillBoxComp')
|
||||
@ecs.register('SSkillBoxComp', false)
|
||||
@@ -74,7 +73,7 @@ export class SSkillBoxComp extends CCComp {
|
||||
oops.audio.playEffect("music/button");
|
||||
oops.gui.open(UIID.SInfo, {
|
||||
uuid: this.s_uuid,
|
||||
card_lv: this.card_lv,
|
||||
skill_lv: this.card_lv,
|
||||
card_icon: this.card_icon,
|
||||
skill_name: this.resolveSkillName(),
|
||||
field: this.field,
|
||||
@@ -95,32 +94,6 @@ export class SSkillBoxComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化技能卡效果:
|
||||
* 1. 从 EquipPoolList 查询装备卡的触发配置(含 trigger_type)。
|
||||
* 2. 更新 UI 显示(图标 + 次数)。
|
||||
*
|
||||
* @param uuid 卡牌 UUID
|
||||
* @param card_lv 技能卡等级
|
||||
*/
|
||||
init(uuid: number, card_lv: number) {
|
||||
this.card_lv = card_lv;
|
||||
|
||||
// 装备卡配置已迁移至 EquipPoolList
|
||||
const config = EquipPoolList.find(c => c.uuid === uuid);
|
||||
if (config) {
|
||||
this.s_uuid = config.skill ?? uuid; // 获取实际的技能 UUID
|
||||
this.card_icon = config.icon; // 保存卡牌自定义图标(优先级最高)
|
||||
this.trigger_type = config.trigger_type ?? CardTriggerType.Instant;
|
||||
this.skill_name = config.name ?? "";
|
||||
} else {
|
||||
this.s_uuid = uuid;
|
||||
this.skill_name = "";
|
||||
}
|
||||
|
||||
this.updateUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化英雄技能图标(英雄图鉴面板专用):
|
||||
* 图标按 s_uuid 直接取 SkillSet / FieldSkillSet 配置,不走 EquipPoolList。
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
* 职责:
|
||||
* 1. 展示技能小图标(SSkillBoxComp)点击后的详细信息弹窗。
|
||||
* 2. 展示技能名称、当前等级、图标、主功能说明。
|
||||
* 3. 展示 2 级 / 3 级 激活状态(已激活显示"已激活",未激活显示"x级激活")
|
||||
* 及相对上一档的能力提升说明。
|
||||
* 3. 展示 1 级 / 2 级 / 3 级 激活状态(已激活显示"已激活",未激活显示"x级激活")。
|
||||
* 4. 点击弹窗外部区域关闭。
|
||||
*
|
||||
* 使用(oops.gui 模块):
|
||||
* oops.gui.open(UIID.SInfo, {
|
||||
* uuid: 8701, // 卡牌/技能 UUID
|
||||
* card_lv: 1, // 当前等级
|
||||
* skill_lv: 1, // 当前等级
|
||||
* card_icon: "xxx", // 图标ID(可选,缺省自动解析)
|
||||
* skill_name: "战后恢复", // 名称(可选)
|
||||
* field: [...], // 驻场词条(装备卡)
|
||||
@@ -23,9 +22,10 @@
|
||||
* 依赖:
|
||||
* - oops.gui(UI 生命周期)—— open / removeByNode
|
||||
* - SkillSet / FieldSkillSet(技能/光环静态配置)
|
||||
* - SkillCardList / EquipPoolList(卡牌静态配置)
|
||||
* - HeroSkillDesc(buildCardDescRich 富文本描述生成,卡牌模式)
|
||||
* - HeroSkillText(buildHeroSkillTierLines 技能分档描述,英雄技能模式)
|
||||
* - SkillCardList(卡牌静态配置)
|
||||
* - CardSkillText(buildCardDescRich 富文本描述生成,卡牌模式)
|
||||
* - HeroSkillText(buildHeroSkillTierLines 技能分档描述,英雄技能模式,
|
||||
* 覆盖普攻/大招、触发技能、驻场光环词条与复活)
|
||||
*/
|
||||
import { _decorator, Node, Label, RichText, NodeEventType, Sprite, Color, input, Input, EventTouch, UITransform, Vec3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
@@ -34,9 +34,8 @@ import { oops } from "db://oops-framework/core/Oops";
|
||||
import { CardTriggerType, CardConfig } from "../common/config/CardSet";
|
||||
import { SkillSet, FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { FieldEntry } from "../common/config/heroSet";
|
||||
import { buildCardDescRich } from "../common/config/HeroSkillDesc";
|
||||
import { buildCardDescRich } from "../common/config/CardSkillText";
|
||||
import { buildHeroSkillTierLines, HeroSkillTierLine } from "../common/HeroSkillText";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
@@ -47,7 +46,7 @@ export interface SInfoParams {
|
||||
/** 卡牌/技能 UUID */
|
||||
uuid: number;
|
||||
/** 当前等级 */
|
||||
card_lv: number;
|
||||
skill_lv: number;
|
||||
/** 图标ID(可选,优先级最高) */
|
||||
card_icon?: string;
|
||||
/** 技能名称(可选) */
|
||||
@@ -68,8 +67,6 @@ interface LvUpgradeInfo {
|
||||
lvText: string;
|
||||
/** 激活状态文本("已激活" 或 "2级激活") */
|
||||
statusText: string;
|
||||
/** 能力提升富文本描述 */
|
||||
desc: string;
|
||||
}
|
||||
|
||||
@ccclass('SinfoComp')
|
||||
@@ -93,6 +90,10 @@ export class SinfoComp extends CCComp {
|
||||
@property({ type: RichText, displayName: "主功能说明" })
|
||||
private main_info: RichText = null;
|
||||
|
||||
/** 1级激活状态标签 */
|
||||
@property({ type: Label, displayName: "1级激活状态" })
|
||||
private main_status: Label = null;
|
||||
|
||||
/** 2级激活状态标签 */
|
||||
@property({ type: Label, displayName: "2级激活状态" })
|
||||
private lv2_status: Label = null;
|
||||
@@ -198,16 +199,16 @@ export class SinfoComp extends CCComp {
|
||||
* - main_info:技能 slv1 完整描述
|
||||
* - lv2_desc:slv2 相对 slv1 的提升;lv3_desc:slv3 及以后档(合并展示)
|
||||
* - lv2/lv3_status:按英雄局外等级(smc.getHeroOuterLv)对比档位解锁等级判定激活
|
||||
* @returns true 已渲染(拦截通用卡牌逻辑);false 技能无分档数据(光环/复活词条),回退通用逻辑
|
||||
* @returns true 已渲染(拦截通用卡牌逻辑);false 技能无分档数据,回退通用卡牌逻辑
|
||||
*/
|
||||
private renderHeroSkill(p: SInfoParams): boolean {
|
||||
const tiers = buildHeroSkillTierLines(p.hero_uuid!, p.uuid);
|
||||
if (tiers.length === 0) return false;
|
||||
|
||||
// 图标 / 名称 / 当前技能等级与通用逻辑一致(card_lv 传的就是当前生效 s_lv)
|
||||
// 图标 / 名称 / 当前技能等级与通用逻辑一致(skill_lv 传的就是当前生效 s_lv)
|
||||
this.renderIcon(p);
|
||||
this.setLabel(this.name_label, this.resolveName(p));
|
||||
this.setLabel(this.lv_label, `Lv.${p.card_lv}`);
|
||||
this.setLabel(this.lv_label, `Lv.${p.skill_lv}`);
|
||||
|
||||
// 技能 1 级:完整能力描述
|
||||
if (this.main_info && this.main_info.isValid) {
|
||||
@@ -217,6 +218,9 @@ export class SinfoComp extends CCComp {
|
||||
// 英雄当前局外等级:激活判定基准
|
||||
const heroLv = Math.max(1, smc.getHeroOuterLv(p.hero_uuid!));
|
||||
|
||||
// 技能 1 级:激活状态与 2/3 级面板同一表示方式(描述已在 main_info 展示,此处仅渲染状态)
|
||||
this.renderLvPanelFromTier(tiers[0], heroLv, this.main_status, null);
|
||||
|
||||
// 技能 2 级 / 3 级(3 级以后档位合并进 3 级栏,多行展示)
|
||||
const lv2 = tiers.find(t => t.sLv === 2);
|
||||
const lv3Plus = tiers.filter(t => t.sLv >= 3);
|
||||
@@ -259,14 +263,16 @@ export class SinfoComp extends CCComp {
|
||||
this.setLabel(this.name_label, name);
|
||||
|
||||
// ---- 当前等级 ----
|
||||
this.setLabel(this.lv_label, `Lv.${p.card_lv}`);
|
||||
this.setLabel(this.lv_label, `Lv.${p.skill_lv}`);
|
||||
|
||||
// ---- 主功能说明 ----
|
||||
this.renderMainInfo(p);
|
||||
|
||||
// ---- 2 级 / 3 级 激活信息 ----
|
||||
// ---- 1 级 / 2 级 / 3 级 激活信息 ----
|
||||
const lv1Info = this.buildLvUpgradeInfo(p, 1);
|
||||
const lv2Info = this.buildLvUpgradeInfo(p, 2);
|
||||
const lv3Info = this.buildLvUpgradeInfo(p, 3);
|
||||
this.renderLvPanel(lv1Info, this.main_status, null);
|
||||
this.renderLvPanel(lv2Info, this.lv2_status, this.lv2_desc);
|
||||
this.renderLvPanel(lv3Info, this.lv3_status, this.lv3_desc);
|
||||
}
|
||||
@@ -287,9 +293,6 @@ export class SinfoComp extends CCComp {
|
||||
/** 解析图标ID */
|
||||
private resolveIconId(p: SInfoParams): string | undefined {
|
||||
if (p.card_icon) return p.card_icon;
|
||||
// 装备卡:从 EquipPoolList 查 icon
|
||||
const equip = EquipPoolList.find(c => c.uuid === p.uuid);
|
||||
if (equip?.icon) return equip.icon;
|
||||
// 技能卡:从 SkillCardList 查 icon
|
||||
const skillCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
|
||||
if (skillCard?.icon) return skillCard.icon;
|
||||
@@ -300,14 +303,14 @@ export class SinfoComp extends CCComp {
|
||||
}
|
||||
// 技能底座:从 SkillSet 取
|
||||
const skillUuid = skillCard?.skill ?? p.uuid;
|
||||
return SkillSet[skillUuid]?.icon;
|
||||
if (SkillSet[skillUuid]?.icon) return SkillSet[skillUuid]!.icon;
|
||||
// 驻场光环词条:uuid 为 FieldSkillSet 词条(英雄图鉴光环弹窗)
|
||||
return FieldSkillSet[p.uuid]?.icon;
|
||||
}
|
||||
|
||||
/** 解析技能名称 */
|
||||
private resolveName(p: SInfoParams): string {
|
||||
if (p.skill_name) return p.skill_name;
|
||||
const equip = EquipPoolList.find(c => c.uuid === p.uuid);
|
||||
if (equip?.name) return equip.name;
|
||||
const skillCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
|
||||
if (skillCard?.name) return skillCard.name;
|
||||
if (p.trigger_type === CardTriggerType.Field && p.field?.length) {
|
||||
@@ -315,7 +318,9 @@ export class SinfoComp extends CCComp {
|
||||
return FieldSkillSet[fieldUuid]?.name ?? "";
|
||||
}
|
||||
const skillUuid = skillCard?.skill ?? p.uuid;
|
||||
return SkillSet[skillUuid]?.name ?? "";
|
||||
if (SkillSet[skillUuid]?.name) return SkillSet[skillUuid]!.name;
|
||||
// 驻场光环词条:名称取 FieldSkillSet(英雄图鉴光环弹窗)
|
||||
return FieldSkillSet[p.uuid]?.name ?? "";
|
||||
}
|
||||
|
||||
/** 渲染主功能说明 */
|
||||
@@ -334,10 +339,7 @@ export class SinfoComp extends CCComp {
|
||||
|
||||
/** 构建 CardConfig 供描述生成器使用 */
|
||||
private buildCardConfig(p: SInfoParams): CardConfig | null {
|
||||
// 优先从装备卡池查
|
||||
const equip = EquipPoolList.find(c => c.uuid === p.uuid);
|
||||
if (equip) return equip;
|
||||
// 其次从技能卡池查
|
||||
// 优先从技能卡池查
|
||||
const skillCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
|
||||
if (skillCard) return skillCard;
|
||||
// 手动构建
|
||||
@@ -347,7 +349,6 @@ export class SinfoComp extends CCComp {
|
||||
cost: 0,
|
||||
weight: 0,
|
||||
kind: 2, // CKind.Skill
|
||||
card_lv: p.card_lv,
|
||||
icon: p.card_icon,
|
||||
name: p.skill_name,
|
||||
field: p.field,
|
||||
@@ -357,8 +358,6 @@ export class SinfoComp extends CCComp {
|
||||
|
||||
/** 解析主功能说明纯文本(兜底) */
|
||||
private resolveInfoText(p: SInfoParams): string {
|
||||
const equip = EquipPoolList.find(c => c.uuid === p.uuid);
|
||||
if (equip?.info) return equip.info;
|
||||
const skillCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
|
||||
if (skillCard?.info) return skillCard.info;
|
||||
const skillUuid = skillCard?.skill ?? p.uuid;
|
||||
@@ -367,40 +366,10 @@ export class SinfoComp extends CCComp {
|
||||
|
||||
/** 构建指定等级的提升信息 */
|
||||
private buildLvUpgradeInfo(p: SInfoParams, targetLv: number): LvUpgradeInfo {
|
||||
const unlocked = p.card_lv >= targetLv;
|
||||
const unlocked = p.skill_lv >= targetLv;
|
||||
const lvText = `Lv.${targetLv}`;
|
||||
const statusText = unlocked ? "已激活" : `${targetLv}级激活`;
|
||||
|
||||
// 能力提升描述:从对应等级的装备卡配置中提取
|
||||
const desc = this.buildLvDesc(p, targetLv);
|
||||
return { unlocked, lvText, statusText, desc };
|
||||
}
|
||||
|
||||
/** 构建指定等级的提升描述 */
|
||||
private buildLvDesc(p: SInfoParams, targetLv: number): string {
|
||||
// 从装备卡池中查找同名更高档位配置
|
||||
const currentEquip = EquipPoolList.find(c => c.uuid === p.uuid);
|
||||
if (currentEquip) {
|
||||
const higher = EquipPoolList.find(c =>
|
||||
c.name === currentEquip.name && c.card_lv === targetLv
|
||||
);
|
||||
if (higher) {
|
||||
return buildCardDescRich(higher);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
// 技能卡:从技能卡池查找同技能更高档位
|
||||
const currentCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
|
||||
if (currentCard) {
|
||||
const skillUuid = currentCard.skill ?? currentCard.uuid;
|
||||
const higher = SkillCardList.find(c =>
|
||||
(c.skill ?? c.uuid) === skillUuid && c.card_lv === targetLv
|
||||
);
|
||||
if (higher) {
|
||||
return buildCardDescRich(higher);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return { unlocked, lvText, statusText };
|
||||
}
|
||||
|
||||
/** 渲染单个等级面板 */
|
||||
@@ -413,7 +382,7 @@ export class SinfoComp extends CCComp {
|
||||
: new Color(150, 150, 150, 255);
|
||||
}
|
||||
if (descRich && descRich.isValid) {
|
||||
descRich.string = info.desc || (info.unlocked ? "" : "未解锁");
|
||||
descRich.string = info.unlocked ? "" : "未解锁";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user