From 1609d3971afe41c62ed56145d3adb51731fee210 Mon Sep 17 00:00:00 2001 From: pan Date: Wed, 12 Aug 2026 09:39:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor(hero=20desc):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E6=8F=8F=E8=BF=B0=E6=B8=B2=E6=9F=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E9=80=82=E9=85=8D=E4=B8=8D=E5=90=8C=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E6=98=BE=E7=A4=BA=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增showName参数控制技能名称是否展示,区分英雄弹窗和卡池场景 2. 修正英雄预制体中角色的Y轴偏移量 3. 同步更新函数注释和调用传参 --- assets/resources/gui/element/cHero.prefab | 2 +- .../script/game/common/config/HeroSkillDesc.ts | 17 ++++++++++------- assets/script/game/map/CHeroComp.ts | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/assets/resources/gui/element/cHero.prefab b/assets/resources/gui/element/cHero.prefab index 8789270a..c5355c03 100644 --- a/assets/resources/gui/element/cHero.prefab +++ b/assets/resources/gui/element/cHero.prefab @@ -4746,7 +4746,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 22.263000000000016, + "y": 14.014, "z": 0 }, "_lrot": { diff --git a/assets/script/game/common/config/HeroSkillDesc.ts b/assets/script/game/common/config/HeroSkillDesc.ts index 596be27a..3cd86f5c 100644 --- a/assets/script/game/common/config/HeroSkillDesc.ts +++ b/assets/script/game/common/config/HeroSkillDesc.ts @@ -1,4 +1,4 @@ -/** +/** * @file HeroSkillDesc.ts * @description 英雄技能/能力描述的【唯一文字表达标准层】 * @@ -554,10 +554,11 @@ export function buildEquipRich(entries: FieldEntry[], showName: boolean = false) * 数据源为运行时 HeroAttrsComp(lv 取当前英雄等级),逐触发类型逐技能渲染。 * 技能等级取 LvTriggerEntry.s_lv,未标注时按档位序号(1/2/3...)兜底。 * - * @param source 英雄运行时数据源(含 lv 与触发技能分组) - * @returns 多行富文本串,\n 分隔 + * @param source 英雄运行时数据源(含 lv 与触发技能分组) + * @param showName 是否展示「技能名」片段(英雄信息弹窗 true,英雄卡池卡片 false) + * @returns 多行富文本串,\n 分隔 */ -export function buildSkillDescMoreRich(source: ISkillDescSource): string { +export function buildSkillDescMoreRich(source: ISkillDescSource, showName: boolean = true): string { const lv = Math.max(1, source.lv ?? 1); const lines: string[] = []; @@ -599,7 +600,7 @@ export function buildSkillDescMoreRich(source: ISkillDescSource): string { ? `${trigName}${valueRich(cur.t_num)}次` : trigName; // 技能名直接展示,不附加档位数字后缀(由 lv 字段控制生效档,玩家无需关注内部档号) - const curHead = `「${skillName}」: ${curTrig}, `; + const curHead = showName ? `「${skillName}」: ${curTrig}, ` : `${curTrig}, `; lines.push(effectRich(buildEffectLine(curHead, mergeSkillParams(base, cur.overrides)))); } } @@ -609,7 +610,7 @@ export function buildSkillDescMoreRich(source: ISkillDescSource): string { if (fieldEntries?.length) { for (const entry of resolveFieldByLv(fieldEntries, lv)) { const baseName = getTriggerSkillName(SkillTriggerType.Field, entry.uuid); - const line = buildFieldLine("", entry, true, baseName); + const line = buildFieldLine("", entry, showName, baseName); if (line) lines.push(effectRich(line)); } } @@ -618,7 +619,9 @@ export function buildSkillDescMoreRich(source: ISkillDescSource): string { const revive = resolveReviveByLv(source[SkillTriggerType.Revive] as LvReviveEntry[] | undefined, lv); if (revive) { const reviveName = getTriggerSkillName(SkillTriggerType.Revive, revive.s_uuid); - lines.push(`${skillNameRich(reviveName)}: 每回合拥有${valueRich(revive.r_num)}次重生机会, 死亡后以${valueRich(`${Math.round(revive.upr * 100)}%`)}血量原地重生`); + lines.push(showName + ? `${skillNameRich(reviveName)}: 每回合拥有${valueRich(revive.r_num)}次重生机会, 死亡后以${valueRich(`${Math.round(revive.upr * 100)}%`)}血量原地重生` + : `每回合拥有${valueRich(revive.r_num)}次重生机会, 死亡后以${valueRich(`${Math.round(revive.upr * 100)}%`)}血量原地重生`); } return lines.join("\n"); diff --git a/assets/script/game/map/CHeroComp.ts b/assets/script/game/map/CHeroComp.ts index b79bf26e..0c2df925 100644 --- a/assets/script/game/map/CHeroComp.ts +++ b/assets/script/game/map/CHeroComp.ts @@ -289,7 +289,7 @@ export class CHeroComp extends CCComp { // 与英雄信息弹窗/升级确认框同一套文案规则,杜绝手写文案与数值漂移 // outlineRich 为整段富文本包裹描边,提升深色面板可读性 if (this.info_rich) { - const desc = hero ? buildSkillDescMoreRich(this.buildHeroDescSource(hero)) : (this.cardData.info || ""); + const desc = hero ? buildSkillDescMoreRich(this.buildHeroDescSource(hero), false) : (this.cardData.info || ""); this.info_rich.string = outlineRich(desc); this.info_rich.node.active = !!desc; }