45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using BaseGames.Localization;
|
||
|
||
namespace BaseGames.Equipment
|
||
{
|
||
/// <summary>
|
||
/// 护符数据 SO(架构 09_ProgressionModule §3)。
|
||
/// 资产路径: Assets/ScriptableObjects/Equipment/Charms/Charm_{Name}.asset
|
||
/// </summary>
|
||
[CreateAssetMenu(menuName = "BaseGames/Equipment/Charm")]
|
||
public class CharmSO : ScriptableObject, ILocalizableAsset
|
||
{
|
||
[Header("Identity")]
|
||
public string charmId; // 全局唯一 ID,如 "Charm_QuickSlash"
|
||
public string displayNameKey; // 本地化 Key
|
||
[TextArea(2, 4)]
|
||
public string descriptionKey;
|
||
|
||
[Header("Visual")]
|
||
public Sprite icon;
|
||
public Color glowColor;
|
||
|
||
[Header("Slot Cost")]
|
||
[Range(1, 4)]
|
||
public int notchCost; // 占用笔记数(1~4)
|
||
|
||
[Header("Effects")]
|
||
[SerializeReference]
|
||
public List<ICharmEffect> effects = new(); // 多态序列化
|
||
|
||
[Header("Lore")]
|
||
public bool isUnique;
|
||
public string unlockHint;
|
||
|
||
public IEnumerable<LocalizationKeyRef> GetLocalizationKeys()
|
||
{
|
||
if (!string.IsNullOrEmpty(displayNameKey))
|
||
yield return new LocalizationKeyRef(displayNameKey, "Items", nameof(displayNameKey));
|
||
if (!string.IsNullOrEmpty(descriptionKey))
|
||
yield return new LocalizationKeyRef(descriptionKey, "Items", nameof(descriptionKey));
|
||
}
|
||
}
|
||
}
|