using System.Collections.Generic; using SLSUtilities.General; using Sirenix.OdinInspector; using SLSUtilities.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 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("对角色 GeneralAttributes 施加固定数值加成")] [LabelText("数值变化 (Numeric)")] public SerializableDictionary generalNumericChange = new SerializableDictionary(); [TabGroup("Data", "属性"), PropertyOrder(21)] [DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(累加)")] [Tooltip("对角色 GeneralAttributes 施加百分比累加加成(如 +10% 填写 0.1)")] [LabelText("百分比变化—累加 (Accum%)")] public SerializableDictionary generalPercentageChangeOfAccumulation = new SerializableDictionary(); [TabGroup("Data", "属性"), PropertyOrder(22)] [DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "百分比(乘法)")] [Tooltip("对角色 GeneralAttributes 施加百分比乘法加成")] [LabelText("百分比变化—乘法 (Multi%)")] public SerializableDictionary generalPercentageChangeOfMultiplication = new SerializableDictionary(); // ── References ──────────────────────────────────────────────────────── [TabGroup("Data", "引用"), PropertyOrder(40)] [ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)] [ValueDropdown("GetAvailablePrefabs", AppendNextDrawer = true)] [LabelText("Prefab 引用")] public List prefabRefs = new List(); [TabGroup("Data", "引用"), PropertyOrder(41)] [ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)] [ValueDropdown("GetAvailableCardData", AppendNextDrawer = true)] [LabelText("衍生卡牌数据引用")] public List derivativeCardDataRefs = new List(); [TabGroup("Data", "引用"), PropertyOrder(42)] [ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)] [ValueDropdown("GetAvailableCharacterData", AppendNextDrawer = true)] [LabelText("衍生角色数据引用")] public List derivativeCharacterDataRefs = new List(); [TabGroup("Data", "引用"), PropertyOrder(43)] [ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)] [ValueDropdown("GetAvailableCardData", AppendNextDrawer = true)] [Tooltip("装备自带的卡牌的引用列表")] [LabelText("附带卡牌引用")] public List belongingCardDataRefs = new List(); // 已预留:升级系统(待设计确定后扩展) // [TabGroup("Data", "升级")] // public List upgrades; } // ───────────────────────────────────────────────────────────────────────── // Runtime: 数据库查询 // ───────────────────────────────────────────────────────────────────────── public partial class EquipmentData { /// /// 通过 DataID 从 ModManager 数据库查找 EquipmentData。 /// public static EquipmentData Get(string dataID) { return ModManager.GetData(dataID); } } // ───────────────────────────────────────────────────────────────────────── // 扩展留白(运行时业务方法在此添加) // ───────────────────────────────────────────────────────────────────────── public partial class EquipmentData { } }