159 lines
9.2 KiB
C#
159 lines
9.2 KiB
C#
using System.Collections.Generic;
|
||
using SLSFramework.General;
|
||
using Sirenix.OdinInspector;
|
||
using SLSFramework.UModAssistance;
|
||
using UnityEngine;
|
||
|
||
namespace Continentis.MainGame.Equipment
|
||
{
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
// EquipmentData — ScriptableObject 数据定义
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
[CreateAssetMenu(menuName = "Continentis/MainGame/Equipment/EquipmentData", fileName = "EquipmentData")]
|
||
public partial class EquipmentData : ScriptableObject
|
||
{
|
||
// ── Fundamental ───────────────────────────────────────────────────────
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(0)]
|
||
[LabelText("使用自定义逻辑类")]
|
||
[Tooltip("勾选后可通过下拉菜单选择 EquipmentBase 子类,modName / className / displayName 将自动填充;" +
|
||
"取消勾选后三个字段变为可手动编辑。")]
|
||
public bool haveCustomClass;
|
||
|
||
// 当 haveCustomClass = true 时,下拉菜单选择逻辑类;
|
||
// OnValueChanged 回调会将结果同步写入 className / modName / displayName。
|
||
// 当 haveCustomClass = false 时,此选择器隐藏,三个字段直接手动编辑。
|
||
[BoxGroup("Fundamental"), PropertyOrder(1)]
|
||
[ShowIf("haveCustomClass")]
|
||
[ValueDropdown("@EquipmentData.GetEquipmentLogicDropdownItems()", AppendNextDrawer = true, DisableGUIInAppendedDrawer = true)]
|
||
[OnValueChanged("OnEquipmentLogicClassSelected")]
|
||
[LabelText("逻辑类全名")]
|
||
public string classFullName;
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(2)]
|
||
[DisableIf("haveCustomClass")]
|
||
[LabelText("逻辑类名")]
|
||
public string className;
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(3)]
|
||
[DisableIf("haveCustomClass")]
|
||
[LabelText("Mod 名称")]
|
||
public string modName;
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(4)]
|
||
[DisableIf("haveCustomClass")]
|
||
[LabelText("显示名称 Key")]
|
||
public string displayName;
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(5)]
|
||
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = true)]
|
||
[LabelText("标签")]
|
||
public List<string> tags;
|
||
|
||
[BoxGroup("Fundamental"), PropertyOrder(6)]
|
||
[LabelText("稀有度")]
|
||
public Rarity equipmentRarity;
|
||
|
||
// ── 图标与描述 ────────────────────────────────────────────────────────
|
||
|
||
[BoxGroup("Display"), PropertyOrder(7)]
|
||
[PreviewField(80, ObjectFieldAlignment.Left), LabelText("装备图标")]
|
||
public Sprite equipmentIcon;
|
||
|
||
[BoxGroup("Display"), PropertyOrder(8)]
|
||
[LabelText("装备描述 Key")]
|
||
public string equipmentDescription;
|
||
|
||
// ── 核心属性变化 ──────────────────────────────────────────────────────
|
||
|
||
[TabGroup("Data", "核心属性"), PropertyOrder(20)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "数值变化")]
|
||
[Tooltip("对角色 CoreAttributes 施加固定数值加成")]
|
||
[LabelText("数值变化 (Numeric)")]
|
||
public SerializableDictionary<string, float> coreNumericChange = new SerializableDictionary<string, float>();
|
||
|
||
[TabGroup("Data", "核心属性"), PropertyOrder(21)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(累加)")]
|
||
[Tooltip("对角色 CoreAttributes 施加百分比累加加成(如 +10% 填写 0.1)")]
|
||
[LabelText("百分比变化—累加 (Accum%)")]
|
||
public SerializableDictionary<string, float> corePercentageChangeOfAccumulation = new SerializableDictionary<string, float>();
|
||
|
||
[TabGroup("Data", "核心属性"), PropertyOrder(22)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(乘法)")]
|
||
[Tooltip("对角色 CoreAttributes 施加百分比乘法加成")]
|
||
[LabelText("百分比变化—乘法 (Multi%)")]
|
||
public SerializableDictionary<string, float> corePercentageChangeOfMultiplication = new SerializableDictionary<string, float>();
|
||
|
||
// ── 通用属性变化 ──────────────────────────────────────────────────────
|
||
|
||
[TabGroup("Data", "通用属性"), PropertyOrder(30)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "数值变化")]
|
||
[Tooltip("对角色 GeneralAttributes 施加固定数值加成")]
|
||
[LabelText("数值变化 (Numeric)")]
|
||
public SerializableDictionary<string, float> generalNumericChange = new SerializableDictionary<string, float>();
|
||
|
||
[TabGroup("Data", "通用属性"), PropertyOrder(31)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(累加)")]
|
||
[Tooltip("对角色 GeneralAttributes 施加百分比累加加成(如 +10% 填写 0.1)")]
|
||
[LabelText("百分比变化—累加 (Accum%)")]
|
||
public SerializableDictionary<string, float> generalPercentageChangeOfAccumulation = new SerializableDictionary<string, float>();
|
||
|
||
[TabGroup("Data", "通用属性"), PropertyOrder(32)]
|
||
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(乘法)")]
|
||
[Tooltip("对角色 GeneralAttributes 施加百分比乘法加成")]
|
||
[LabelText("百分比变化—乘法 (Multi%)")]
|
||
public SerializableDictionary<string, float> generalPercentageChangeOfMultiplication = new SerializableDictionary<string, float>();
|
||
|
||
// ── References ────────────────────────────────────────────────────────
|
||
|
||
[TabGroup("Data", "引用"), PropertyOrder(40)]
|
||
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
|
||
[ValueDropdown("GetAvailablePrefabs", AppendNextDrawer = true)]
|
||
[LabelText("Prefab 引用")]
|
||
public List<string> prefabRefs = new List<string>();
|
||
|
||
[TabGroup("Data", "引用"), PropertyOrder(41)]
|
||
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
|
||
[ValueDropdown("GetAvailableCardData", AppendNextDrawer = true)]
|
||
[LabelText("衍生卡牌数据引用")]
|
||
public List<string> derivativeCardDataRefs = new List<string>();
|
||
|
||
[TabGroup("Data", "引用"), PropertyOrder(42)]
|
||
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
|
||
[ValueDropdown("GetAvailableCharacterData", AppendNextDrawer = true)]
|
||
[LabelText("衍生角色数据引用")]
|
||
public List<string> derivativeCharacterDataRefs = new List<string>();
|
||
|
||
[TabGroup("Data", "引用"), PropertyOrder(43)]
|
||
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
|
||
[ValueDropdown("GetAvailableCardData", AppendNextDrawer = true)]
|
||
[Tooltip("装备自带的卡牌的引用列表")]
|
||
[LabelText("附带卡牌引用")]
|
||
public List<string> belongingCardDataRefs = new List<string>();
|
||
|
||
// 已预留:升级系统(待设计确定后扩展)
|
||
// [TabGroup("Data", "升级")]
|
||
// public List<EquipmentData> upgrades;
|
||
}
|
||
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
// Runtime: 数据库查询
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
public partial class EquipmentData
|
||
{
|
||
/// <summary>
|
||
/// 通过 DataID 从 ModManager 数据库查找 EquipmentData。
|
||
/// </summary>
|
||
public static EquipmentData Get(string dataID)
|
||
{
|
||
return ModManager.GetData<EquipmentData>(dataID);
|
||
}
|
||
}
|
||
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
// 扩展留白(运行时业务方法在此添加)
|
||
// ─────────────────────────────────────────────────────────────────────────
|
||
public partial class EquipmentData
|
||
{
|
||
}
|
||
} |