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

@@ -1,10 +1,23 @@
<template>
<div class="override-editor">
<div v-for="(item, idx) in rows" :key="idx" class="override-row">
<el-select v-model="item.key" placeholder="字段" size="small" style="width: 200px" filterable>
<el-select v-model="item.key" placeholder="字段" size="small" style="width: 220px" filterable>
<el-option v-for="k in availableKeys(idx)" :key="k.key" :label="k.label" :value="k.key" />
</el-select>
<el-input-number v-model="item.value" size="small" :controls="false" style="width: 120px" />
<!-- 字符串型覆写(icon):输入帧名,提供常用候选可筛选 -->
<el-select
v-if="isStringKey(item.key)"
v-model="item.value"
placeholder="图标帧名"
size="small"
style="width: 280px"
filterable
allow-create
default-first-option
>
<el-option v-for="opt in SKILL_ICON_OPTIONS" :key="opt" :label="opt" :value="opt" />
</el-select>
<el-input-number v-else v-model="item.value" size="small" :controls="false" style="width: 120px" />
<el-button type="danger" size="small" text @click="remove(idx)">删除</el-button>
</div>
<el-button size="small" @click="add">+ 添加覆盖</el-button>
@@ -13,7 +26,7 @@
<script setup>
import { ref, watch } from 'vue'
import { OVERRIDE_KEYS } from '../constants'
import { OVERRIDE_KEYS, SKILL_ICON_OPTIONS } from '../constants'
const props = defineProps({ modelValue: { type: Object, default: () => ({}) } })
const emit = defineEmits(['update:modelValue'])
@@ -43,6 +56,11 @@ function availableKeys(idx) {
return OVERRIDE_KEYS.filter((k) => !used.has(k.key))
}
// 该覆写字段是否为字符串型(icon 取帧名,非数值)
function isStringKey(key) {
return OVERRIDE_KEYS.find((k) => k.key === key)?.type === 'string'
}
function add() {
rows.value.push({ key: '', value: 0 })
}

View File

@@ -28,8 +28,8 @@
<OverrideEditor v-model="skill.overrides" />
</el-form-item>
<template v-if="isUlt">
<el-divider content-position="left">大招 lv_entries 分档</el-divider>
<template>
<el-divider content-position="left">{{ isUlt ? '大招' : '普攻' }} lv_entries 分档</el-divider>
<div v-for="(e, idx) in skill.lv_entries" :key="idx" class="skill-block">
<div class="head">
<span>档位 lv {{ e.lv }} (SkillLv.Lv{{ e.s_lv }})</span>
@@ -52,8 +52,10 @@
<el-input v-model="e.desc" type="textarea" :rows="2" />
</el-form-item>
</div>
<el-button size="small" @click="addEntry">+ 添加档位(lv9/lv16)</el-button>
<span class="muted" style="margin-left: 8px">建议按 lv9 / lv16 两档</span>
<el-button size="small" @click="addEntry">+ 添加档位(普攻 lv2/lv3,大招 lv9/lv16)</el-button>
<span class="muted" style="margin-left: 8px">
{{ isUlt ? '建议按 lv9 / lv16 两档' : '普攻 lv2 档将作为独立技能图标展示(名称/图标取 lv1)' }}
</span>
</template>
</div>
</template>

View File

@@ -117,4 +117,18 @@ export const OVERRIDE_KEYS = [
{ key: 'call_hero', label: 'call_hero 召唤英雄id' },
{ key: 'revive_hp', label: 'revive_hp 复活回血比例(%)' },
{ key: 'revive_count', label: 'revive_count 复活次数上限' },
// 字符串型覆写:value 为图标ID(uicons 图集帧名),非数值
{ key: 'icon', label: 'icon 英雄语境图标(覆写 SkillSet.icon)', type: 'string' },
]
// icon 覆写常用候选(SkillSet 各底座图标 + 通用图标),可在输入框直接键入其他帧名
export const SKILL_ICON_OPTIONS = [
'Stat_Attack_01', 'Stat_RangedAttack', 'Stat_Tripleshot',
'Sword-FA_WP_Main_Sword_003_PurpleSilver',
'Sword-FA_WP_Main_Sword_019_WoodSilver',
'Axe-FA_WP_Main_Axe_004_WoodGray',
'Sub_Item-FA_WP_Sub_MagicBall_001_Blue',
'Sub_Item-FA_WP_Sub_MagicBall_001_Purple',
'Sub_Item-FA_WP_Sub_Potion_001_Green',
'Sub_Item-FA_WP_Sub_Potion_001_Red',
]