架构大更

This commit is contained in:
SoulliesOfficial
2026-03-20 11:56:50 -04:00
parent e60ef64d01
commit d09b58fd80
3663 changed files with 15232012 additions and 105579 deletions

View File

@@ -1,92 +1,188 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Continentis.MainGame.Character;
using SLSFramework.General;
using UnityEngine;
using NaughtyAttributes;
using Sirenix.OdinInspector;
using SLSFramework.UModAssistance;
using UnityEngine;
using UnityEngine.Serialization;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Continentis.MainGame.Card
{
public enum CardType
{
Attack = 0,
Skill = 10,
Power = 20,
Skill = 10,
Power = 20,
Status = 30,
Curse = 40,
Item = 50,
Curse = 40,
Item = 50,
}
// ─────────────────────────────────────────────────────────────────────────
// CardData — ScriptableObject 数据定义
// ─────────────────────────────────────────────────────────────────────────
[CreateAssetMenu(menuName = "Continentis/MainGame/Card/CardData", fileName = "CardData")]
public partial class CardData : ScriptableObject
{
[Header("Fundamental")]
public string modName;
public string categoryName;
// ── Fundamental ───────────────────────────────────────────────────────
[BoxGroup("Fundamental"), PropertyOrder(0)]
[ValueDropdown("@CardData.GetCardLogicDropdownItems()", AppendNextDrawer = true, DisableGUIInAppendedDrawer = true)]
[LabelText("逻辑类名"), OnValueChanged("OnCardLogicClassSelected")]
public string className;
[BoxGroup("Fundamental"), PropertyOrder(1)]
[ReadOnly, LabelText("Mod 名称")]
public string modName;
[BoxGroup("Fundamental"), PropertyOrder(2)]
[ReadOnly, LabelText("分类名称")]
public string categoryName;
[BoxGroup("Fundamental"), PropertyOrder(3)]
[ReadOnly, LabelText("显示名称 Key")]
public string displayName;
[BoxGroup("Fundamental"), PropertyOrder(4)]
[LabelText("稀有度")]
public Rarity cardRarity;
[BoxGroup("Fundamental"), PropertyOrder(5)]
[LabelText("卡牌类型")]
public CardType cardType;
[BoxGroup("Fundamental"), PropertyOrder(6)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = true)]
[ValueDropdown("GetAvailableKeywords", AppendNextDrawer = true)]
[LabelText("关键词")]
public List<string> keywords;
// ── Display ───────────────────────────────────────────────────────────
[BoxGroup("Display"), PropertyOrder(7)]
[PreviewField(80, ObjectFieldAlignment.Left)]
[LabelText("卡牌图片")]
public Sprite cardSprite;
[BoxGroup("Display"), PropertyOrder(8)]
[LabelText("功能文本 Key")]
public string functionText;
[BoxGroup("Display"), PropertyOrder(9)]
[LabelText("卡牌描述 Key")]
public string cardDescription;
[BoxGroup("Display"), PropertyOrder(10)]
[ListDrawerSettings(ShowIndexLabels = false), LabelText("布局标签")]
public List<string> cardLayoutTags;
public string functionText;
public string cardDescription;
// ── Attributes ────────────────────────────────────────────────────────
[Header("Intention")]
public List<string> intentionIconKeys;
public List<string> intentionValueNames;
public string intentionTextOverride;
public float baseWeight = 0f;
[Header("Attributes")] [Tooltip("可变属性这个属性会自动设置BaseAttr进入Original设置AttrBaseAttrOffset=0以及DisplayAttr进入Current")]
[TabGroup("Data", "属性"), PropertyOrder(20)]
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "属性值")]
[Tooltip("可变属性:自动设置 BaseAttr → Original设置 Attr / BaseAttrOffset=0 / DisplayAttr → Current")]
[LabelText("可变属性 (Variable)")]
public SerializableDictionary<string, float> variableAttributes = new SerializableDictionary<string, float>();
[Tooltip("基础属性,不会改变,通常情况下不会直接使用")]
[TabGroup("Data", "属性"), PropertyOrder(21)]
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "属性值")]
[Tooltip("基础属性,运行时不会改变,通常不直接使用。")]
[LabelText("基础属性 (Original)")]
public SerializableDictionary<string, float> originalAttributes = new SerializableDictionary<string, float>();
[TabGroup("Data", "属性"), PropertyOrder(22)]
[DictionaryDrawerSettings(KeyLabel = "属性名", ValueLabel = "初始值表达式")]
[FormerlySerializedAs("endowingCurrentAttributes")]
[Tooltip("初始化时赋予给CurrentAttributes的属性第一栏是属性名第二栏是初始化时使用对应名称的OriginalAttributes的留空则默认为0如果是float数字则直接使用该数字")]
[Tooltip("运行时当前属性Value 填写对应 OriginalAttributes 的 Key 名,或直接填浮点数,留空则默认为 0。")]
[LabelText("运行时当前属性 (Runtime Current)")]
public SerializableDictionary<string, string> runtimeCurrentAttributes = new SerializableDictionary<string, string>();
[Header("Upgrade")] public CardUpgradeNode upgradeNode;
// ── Upgrade ───────────────────────────────────────────────────────────
[Header("References")] public List<string> prefabRefs = new List<string>();
[TabGroup("Data", "升级"), PropertyOrder(40)]
[HideLabel]
public CardUpgradeNode upgradeNode;
// ── References ────────────────────────────────────────────────────────
[TabGroup("Data", "引用"), PropertyOrder(50)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
[ValueDropdown("GetAvailablePrefabs", AppendNextDrawer = true)]
[LabelText("Prefab 引用")]
public List<string> prefabRefs = new List<string>();
[TabGroup("Data", "引用"), PropertyOrder(51)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
[ValueDropdown("GetAvailableCardData", AppendNextDrawer = true)]
[LabelText("衍生卡牌数据引用")]
public List<string> derivativeCardDataRefs = new List<string>();
[TabGroup("Data", "引用"), PropertyOrder(52)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
[ValueDropdown("GetAvailableCharacterData", AppendNextDrawer = true)]
[LabelText("衍生角色数据引用")]
public List<string> derivativeCharacterDataRefs = new List<string>();
// ── Intention ────────────────────────────────────────────────────────
[TabGroup("Data", "意图"), PropertyOrder(60)]
[ListDrawerSettings(ShowIndexLabels = false)]
[ValueDropdown("GetAvailableIntentionIcons", AppendNextDrawer = true)]
[LabelText("意图图标 Keys")]
public List<string> intentionIconKeys;
[TabGroup("Data", "意图"), PropertyOrder(61)]
[ListDrawerSettings(ShowIndexLabels = false)]
[ValueDropdown("GetVariableAttributeKeys", AppendNextDrawer = true)]
[LabelText("意图数值名")]
public List<string> intentionValueNames;
[TabGroup("Data", "意图"), PropertyOrder(62)]
[LabelText("意图文本覆盖")]
public string intentionTextOverride;
[FormerlySerializedAs("baseWeight")]
[TabGroup("Data", "意图"), PropertyOrder(63)]
[LabelText("基础权重"), Range(0f, 100f)]
public float intentionBaseWeight = 0f;
}
// ─────────────────────────────────────────────────────────────────────────
// Runtime: 关键词查询
// ─────────────────────────────────────────────────────────────────────────
public partial class CardData
{
/// <summary>
/// 检查此卡牌是否包含指定关键词。
/// </summary>
public bool HasKeyword(string keyword)
{
return keywords.Contains(keyword);
}
}
// ─────────────────────────────────────────────────────────────────────────
// Runtime: 数据库查询
// ─────────────────────────────────────────────────────────────────────────
public partial class CardData
{
/// <summary>
/// 通过 DataID 从 ModManager 数据库查找 CardData。
/// </summary>
public static CardData Get(string dataID)
{
return ModManager.GetData<CardData>(dataID);
}
}
// ─────────────────────────────────────────────────────────────────────────
// Runtime: 衍生数据访问
// ─────────────────────────────────────────────────────────────────────────
public partial class CardData
{
/// <summary>
/// 通过索引获取衍生卡牌数据
/// 通过索引获取衍生卡牌数据
/// </summary>
public CardData GetDerivativeCardData(int index)
{
@@ -94,13 +190,11 @@ namespace Continentis.MainGame.Card
}
/// <summary>
/// 通过索引获取衍生角色数据
/// 通过索引获取衍生角色数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public CharacterData GetDerivativeCharacterData(int index)
{
return ModManager.GetData<CharacterData>(derivativeCharacterDataRefs[index]);
}
}
}
}