feat: 新增技能图标英雄语境覆写功能
1. 扩展SkillOverrides接口,新增icon字段支持自定义图标 2. 前端常量与编辑器适配:新增字符串型覆写类型与图标候选选择器 3. 新增getHeroSkillIcon工具函数,实现英雄专属图标优先级加载逻辑 4. 修复并优化技能图标展示逻辑,支持同底座技能不同英雄差异化图标 5. 重构部分英雄配置格式,统一代码风格
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user