using System; using System.Collections.Generic; using System.Linq; using Continentis.MainGame.Card; using Continentis.MainGame.Character; using SLSFramework.General; using SLSFramework.UModAssistance; using UnityEngine; using UnityEngine.Serialization; namespace Continentis.MainGame.Equipment { [CreateAssetMenu(menuName = "Continentis/MainGame/Equipment/EquipmentData", fileName = "EquipmentData")] public partial class EquipmentData : ScriptableObject { [Header("Fundamental")] public bool haveCustomClass; public string classFullName; public string modName; public string className; public string displayName; public List tags; public Rarity equipmentRarity; public Sprite equipmentIcon; [TextArea(1, 10)] public string equipmentDescription; [Header("Attributes")] public SerializableDictionary coreNumericChange = new SerializableDictionary(); public SerializableDictionary corePercentageChangeOfAccumulation = new SerializableDictionary(); public SerializableDictionary corePercentageChangeOfMultiplication = new SerializableDictionary(); public SerializableDictionary generalNumericChange = new SerializableDictionary(); public SerializableDictionary generalPercentageChangeOfAccumulation = new SerializableDictionary(); public SerializableDictionary generalPercentageChangeOfMultiplication = new SerializableDictionary(); [Header("References")] public List prefabRefs = new List(); public List derivativeCardDataRefs = new List(); public List derivativeCharacterDataRefs = new List(); [Tooltip("装备自带的卡牌的引用列表")] public List belongingCardDataRefs = new List(); //[Header("Upgrades")] //public List upgrades; } public partial class EquipmentData { public string ModName => haveCustomClass ? classFullName.Split('_').First() : modName; public string ClassName => haveCustomClass ? classFullName.Split('_').Last() : className; } public partial class EquipmentData { public static EquipmentData Get(string dataID) { return ModManager.GetData(dataID); } } public partial class EquipmentData { } #if UNITY_EDITOR public partial class EquipmentData { /* private IEnumerable> GetLogicTypes() { IEnumerable types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(assembly => assembly.GetTypes()) .Where(t => typeof(EquipmentBase).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface); // 我们将从命名空间中移除这个公共前缀,让路径更简洁 string commonNamespacePrefix = "Continentis.Mods"; foreach (var type in types) { string path = "Uncategorized/" + type.Name; // 默认路径 if (type.Namespace != null && type.Namespace.StartsWith(commonNamespacePrefix)) { // 1. 移除公共前缀 string formattedNamespace = type.Namespace.Substring(commonNamespacePrefix.Length); // 2. 移除特定的子命名空间部分(例如 "Cards") formattedNamespace = formattedNamespace.Replace(".Equipments", ""); // 3. 将点 '.' 替换为斜杠 '/' 来创建分组 formattedNamespace = formattedNamespace.Replace('.', '/'); // 4. 组合成最终的路径 path = formattedNamespace + "/" + type.Name; } yield return new ValueDropdownItem(path, type); } } */ } #endif }