Files
Continentis/Assets/Scripts/MainGame/Equipment/EquipmentData.cs

97 lines
3.8 KiB
C#
Raw Normal View History

2025-10-03 00:02:43 -04:00
using System;
using System.Collections.Generic;
using System.Linq;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
2025-10-23 00:49:44 -04:00
using SLSFramework.General;
using SLSFramework.UModAssistance;
2025-10-03 00:02:43 -04:00
using UnityEngine;
using UnityEngine.Serialization;
namespace Continentis.MainGame.Equipment
{
[CreateAssetMenu(menuName = "Continentis/MainGame/Equipment/EquipmentData", fileName = "EquipmentData")]
2025-10-23 00:49:44 -04:00
public partial class EquipmentData : ScriptableObject
2025-10-03 00:02:43 -04:00
{
2025-10-23 00:49:44 -04:00
[Header("Fundamental")]
public bool haveCustomClass;
public string modName;
public string className;
public string displayName;
2025-10-03 00:02:43 -04:00
public List<string> tags;
2025-10-23 00:49:44 -04:00
public Rarity equipmentRarity;
public Sprite equipmentIcon;
2025-10-03 00:02:43 -04:00
[TextArea(1, 10)]
public string equipmentDescription;
2025-10-23 00:49:44 -04:00
[Header("Attributes")]
public SerializableDictionary<string, float> coreNumericChange = new SerializableDictionary<string, float>();
public SerializableDictionary<string, float> corePercentageChangeOfAccumulation = new SerializableDictionary<string, float>();
public SerializableDictionary<string, float> corePercentageChangeOfMultiplication = new SerializableDictionary<string, float>();
2025-10-03 00:02:43 -04:00
2025-10-23 00:49:44 -04:00
public SerializableDictionary<string, float> generalNumericChange = new SerializableDictionary<string, float>();
public SerializableDictionary<string, float> generalPercentageChangeOfAccumulation = new SerializableDictionary<string, float>();
public SerializableDictionary<string, float> generalPercentageChangeOfMultiplication = new SerializableDictionary<string, float>();
2025-10-03 00:02:43 -04:00
2025-10-23 00:49:44 -04:00
[Header("References")]
public List<string> prefabRefs = new List<string>();
public List<string> derivativeCardDataRefs = new List<string>();
public List<string> derivativeCharacterDataRefs = new List<string>();
[Tooltip("装备自带的卡牌的引用列表")]
public List<string> belongingCardDataRefs = new List<string>();
//[Header("Upgrades")]
//public List<EquipmentData> upgrades;
2025-10-03 00:02:43 -04:00
}
2025-10-23 00:49:44 -04:00
public partial class EquipmentData
{
public static EquipmentData Get(string dataID)
2025-10-03 00:02:43 -04:00
{
2025-10-23 00:49:44 -04:00
return ModManager.GetData<EquipmentData>(dataID);
2025-10-03 00:02:43 -04:00
}
}
2025-10-23 00:49:44 -04:00
public partial class EquipmentData
{
}
2025-10-03 00:02:43 -04:00
#if UNITY_EDITOR
public partial class EquipmentData
{
2025-10-23 00:49:44 -04:00
/*
2025-10-03 00:02:43 -04:00
private IEnumerable<ValueDropdownItem<Type>> GetLogicTypes()
{
IEnumerable<Type> 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<Type>(path, type);
}
}
2025-10-23 00:49:44 -04:00
*/
2025-10-03 00:02:43 -04:00
}
#endif
}