feat: 新增技能图标英雄语境覆写功能

1. 扩展SkillOverrides接口,新增icon字段支持自定义图标
2. 前端常量与编辑器适配:新增字符串型覆写类型与图标候选选择器
3. 新增getHeroSkillIcon工具函数,实现英雄专属图标优先级加载逻辑
4. 修复并优化技能图标展示逻辑,支持同底座技能不同英雄差异化图标
5. 重构部分英雄配置格式,统一代码风格
This commit is contained in:
pan
2026-09-04 16:25:57 +08:00
parent 2a2abf24b2
commit e97de40d2e
7 changed files with 178 additions and 59 deletions

View File

@@ -6,7 +6,7 @@ import { CardTriggerType } from "../common/config/CardSet";
import { SkillSet, FieldSkillSet } from "../common/config/SkillSet";
import {
FieldEntry, HeroInfo, TriggerGrouped, SkillTriggerType,
getGroupedTriggerName, getFieldSkillName, getTriggerGroupName, getFieldGroupName,
getGroupedTriggerName, getFieldSkillName, getTriggerGroupName, getFieldGroupName, getHeroSkillIcon,
} from "../common/config/heroSet";
import { UIID } from "../common/config/GameUIConfig";
import { smc } from "../common/SingletonModuleComp";
@@ -234,15 +234,19 @@ export class SSkillBoxComp extends CCComp {
// 优先使用卡牌自定义 icon;未定义则按图鉴模式 / 装备卡 trigger_type 自动取
let iconId: string | undefined = this.card_icon;
if (!iconId) {
if (this.hero_icon_source === "field") {
// 英雄图鉴:驻场光环词条图标取 FieldSkillSet
if (this.hero_uuid > 0) {
// 英雄图鉴:英雄语境图标优先(overrides.icon 覆写),底座 icon 兜底
iconId = getHeroSkillIcon(HeroInfo[this.hero_uuid], this.s_uuid, this.hero_slot, this.hero_group);
}
if (!iconId && this.hero_icon_source === "field") {
// 光环词条图标取 FieldSkillSet
iconId = this.s_uuid ? FieldSkillSet[this.s_uuid]?.icon : undefined;
} else if (this.hero_icon_source === "skill") {
// 英雄图鉴:大招/触发技能图标取 SkillSet
} else if (!iconId && this.hero_icon_source === "skill") {
// 大招/触发技能图标取 SkillSet
iconId = this.s_uuid ? SkillSet[this.s_uuid]?.icon : undefined;
} else if (this.trigger_type === CardTriggerType.Interval) {
} else if (!iconId && this.trigger_type === CardTriggerType.Interval) {
iconId = this.s_uuid ? SkillSet[this.s_uuid]?.icon : undefined;
} else if (this.trigger_type === CardTriggerType.Field) {
} else if (!iconId && this.trigger_type === CardTriggerType.Field) {
const fieldUuid = this.field?.[0]?.uuid;
iconId = fieldUuid ? FieldSkillSet[fieldUuid]?.icon : undefined;
}

View File

@@ -35,7 +35,7 @@ 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 } from "../common/config/heroSet";
import { FieldEntry, SkillTriggerType, HeroInfo, getHeroSkillIcon } from "../common/config/heroSet";
import { buildCardDescRich } from "../common/config/CardSkillText";
import { buildHeroSkillTierLines, buildHeroGroupTierLines, HeroSkillTierLine } from "../common/HeroSkillText";
import { smc } from "../common/SingletonModuleComp";
@@ -372,6 +372,10 @@ export class SinfoComp extends CCComp {
/** 解析图标ID */
private resolveIconId(p: SInfoParams): string | undefined {
if (p.card_icon) return p.card_icon;
// 英雄图鉴模式:英雄语境图标优先(overrides.icon 覆写),底座 icon 兜底
if (p.hero_uuid) {
return getHeroSkillIcon(HeroInfo[p.hero_uuid], p.uuid, p.hero_slot, p.hero_group);
}
// 技能卡:从 SkillCardList 查 icon
const skillCard = SkillCardList.find(c => c.uuid === p.uuid || c.skill === p.uuid);
if (skillCard?.icon) return skillCard.icon;