feat(hero-config): 新增英雄额外属性加成档位的图鉴展示支持
本次变更完成了英雄bonus属性加成系统的图鉴可视化改造: 1. 扩展LvBonusAttrsEntry类型,新增name/icon/info配置字段 2. 服务端渲染兼容新增字段,仅在配置存在时输出 3. 更新英雄配置文档,补充bonus字段的新参数说明 4. 新增属性加成编辑器表单,支持配置名称、图标和自定义描述 5. 实现英雄图鉴的bonus档位图标渲染逻辑,支持锁定状态和点击弹窗 6. 新增bonus效果文案生成工具,支持自定义模板和属性自动生成 7. 为技能弹窗新增bonus专属渲染逻辑,适配属性加成档位的展示 8. 为部分测试英雄配置了bonus档位的名称属性
This commit is contained in:
@@ -35,9 +35,9 @@ 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 { FieldEntry, SkillTriggerType, HeroInfo, getHeroSkillIcon } from "../common/config/heroSet";
|
||||
import { FieldEntry, SkillTriggerType, HeroInfo, getHeroSkillIcon, LvBonusAttrsEntry } from "../common/config/heroSet";
|
||||
import { buildCardDescRich } from "../common/config/CardSkillText";
|
||||
import { buildHeroSkillTierLines, buildHeroGroupTierLines, HeroSkillTierLine } from "../common/HeroSkillText";
|
||||
import { buildHeroSkillTierLines, buildHeroGroupTierLines, HeroSkillTierLine, buildBonusEffectDesc } from "../common/HeroSkillText";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -67,6 +67,9 @@ export interface SInfoParams {
|
||||
/** 普攻 lv2+ 强化档专属模式(英雄图鉴):名称/图标取 lv1,只展示 lv2+ 档位说明
|
||||
* (裁剪 lv1 档,隐藏 2/3 级面板);等级显示偏移一档(配置 Lv2 → 显示 Lv1,Lv3 → Lv2) */
|
||||
hero_normal_lv2?: boolean;
|
||||
/** bonus 档位模式(英雄图鉴):直接透传额外属性加成档位,弹窗走专属渲染
|
||||
* (名称/图标取档位配置,主说明为 attrs 自动生成或 info 模板,无分档面板) */
|
||||
bonus_entry?: LvBonusAttrsEntry;
|
||||
}
|
||||
|
||||
/** 等级提升信息(用于 2 级 / 3 级面板) */
|
||||
@@ -311,6 +314,42 @@ export class SinfoComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bonus 档位模式渲染:展示额外属性加成某一档位的名称/图标/效果/解锁状态。
|
||||
* 名称取 entry.name,图标取 entry.icon,主说明为 attrs 自动生成或 info 模板;
|
||||
* 隐藏 2/3 级面板(bonus 档位各自独立出图标,无需分档对比)。
|
||||
*/
|
||||
private renderBonus(p: SInfoParams) {
|
||||
const entry = p.bonus_entry!;
|
||||
// 图标:直接用档位配置的 icon(不经底座解析)
|
||||
if (this.icon_node && this.icon_node.isValid) {
|
||||
let sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite);
|
||||
if (smc.skillIconsAtlas && entry.icon) {
|
||||
sprite.spriteFrame = smc.skillIconsAtlas.getSpriteFrame(entry.icon) || null;
|
||||
} else {
|
||||
sprite.spriteFrame = null;
|
||||
}
|
||||
}
|
||||
this.setLabel(this.name_label, entry.name ?? "属性强化");
|
||||
// 等级标签展示解锁所需英雄等级
|
||||
this.setLabel(this.lv_label, `Lv.${entry.lv}`);
|
||||
// 主说明:attrs 自动生成效果文案(或 info 模板)
|
||||
if (this.main_info && this.main_info.isValid) {
|
||||
this.main_info.string = buildBonusEffectDesc(entry);
|
||||
}
|
||||
// 激活状态:英雄局外等级对比档位解锁等级
|
||||
const heroLv = p.hero_uuid ? Math.max(1, smc.getHeroOuterLv(p.hero_uuid)) : 1;
|
||||
const unlocked = heroLv >= entry.lv;
|
||||
if (this.main_status && this.main_status.isValid) {
|
||||
this.main_status.string = unlocked ? "已激活" : `${entry.lv}级解锁`;
|
||||
this.main_status.color = unlocked ? new Color(0, 255, 10, 255) : new Color(150, 150, 150, 255);
|
||||
}
|
||||
this.updateInactiveBg(unlocked);
|
||||
// 隐藏 2/3 级面板
|
||||
this.setPanelActive(this.lv2_node, false);
|
||||
this.setPanelActive(this.lv3_node, false);
|
||||
}
|
||||
|
||||
/** 按档位渲染单等级面板:激活状态按英雄等级对比档位解锁等级 */
|
||||
private renderLvPanelFromTier(tier: HeroSkillTierLine | undefined, heroLv: number, statusLabel: Label | null, descRich: RichText | null) {
|
||||
if (statusLabel && statusLabel.isValid) {
|
||||
@@ -331,6 +370,12 @@ export class SinfoComp extends CCComp {
|
||||
if (!this.params) return;
|
||||
const p = this.params;
|
||||
|
||||
// ---- bonus 档位模式:专属渲染(名称/图标取档位配置,无分档面板) ----
|
||||
if (p.bonus_entry) {
|
||||
this.renderBonus(p);
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- 英雄技能模式:按英雄语境渲染分档描述(文本二) ----
|
||||
if (p.hero_uuid && this.renderHeroSkill(p)) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user