Files
SoulliesOfficial ac98ec3aef 更新
2026-04-17 12:01:50 -04:00

146 lines
7.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using Continentis.MainGame.Card;
using Continentis.MainGame.UI;
using Sirenix.OdinInspector;
using SLSUtilities.UModAssistance;
using SLSUtilities.General;
using UnityEngine;
using UnityEngine.Serialization;
namespace Continentis.MainGame.Character
{
// ─────────────────────────────────────────────────────────────────────────
// CharacterData — ScriptableObject 数据定义
// ─────────────────────────────────────────────────────────────────────────
[CreateAssetMenu(menuName = "Continentis/MainGame/Character/CharacterData", fileName = "CharacterData")]
public partial class CharacterData : ScriptableObject
{
// ── Fundamental ───────────────────────────────────────────────────────
[BoxGroup("Fundamental"), PropertyOrder(0)]
[LabelText("使用自定义逻辑类")]
[Tooltip("勾选后可通过下拉菜单选择一个 CharacterLogicBase 子类,并自动填充 modName / className。")]
public bool haveCustomClass;
// haveCustomClass = true 时:逻辑类选择器(替代旧 DrawSearchableTypeSelector
[BoxGroup("Fundamental"), PropertyOrder(1)]
[ShowIf("haveCustomClass")]
[InfoBox("请通过下拉菜单选择角色逻辑类Mod 名 / 类名将自动填充。", InfoMessageType.None)]
[ValueDropdown("@CharacterData.GetCharacterLogicDropdownItems()", AppendNextDrawer = true, DisableGUIInAppendedDrawer = true)]
[LabelText("逻辑类全名"), OnValueChanged("OnCharacterLogicClassSelected")]
public string classFullName;
// haveCustomClass = false 时:手动填写 modName / className
[BoxGroup("Fundamental"), PropertyOrder(2)]
[HideIf("haveCustomClass")]
[LabelText("Mod 名称")]
public string modName;
[BoxGroup("Fundamental"), PropertyOrder(3)]
[HideIf("haveCustomClass")]
[LabelText("类名称")]
public string className;
[BoxGroup("Fundamental"), PropertyOrder(4)]
[LabelText("显示名称 Key")]
public string displayName;
[BoxGroup("Fundamental"), PropertyOrder(5)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = true)]
[LabelText("标签")]
public List<string> tags;
// ── 立绘与描述 ────────────────────────────────────────────────────────
[BoxGroup("Visuals"), PropertyOrder(6)]
[PreviewField(80, ObjectFieldAlignment.Left), LabelText("头像 (Avatar)")]
public Sprite avatar;
[BoxGroup("Visuals"), PropertyOrder(7)]
[PreviewField(120, ObjectFieldAlignment.Left), LabelText("立绘 (Portrait)")]
public Sprite portrait;
[BoxGroup("Visuals"), PropertyOrder(8)]
[LabelText("角色描述 Key")]
public string characterDescription;
[BoxGroup("Visuals"), PropertyOrder(9)]
[LabelText("角色故事 Key")]
public string characterStory;
// ── Attributes ────────────────────────────────────────────────────────
[TabGroup("Data", "属性"), PropertyOrder(20)]
[Tooltip("角色的属性:支持智能下拉菜单")]
public SerializedDictionary<string, float, CharacterAttributePair> generalAttributes = new SerializedDictionary<string, float, CharacterAttributePair>();
[TabGroup("Data", "属性"), PropertyOrder(22)]
[DictionaryDrawerSettings(KeyLabel = "运行时状态槽 (如 Health)", ValueLabel = "绑定的最大值标记 (如 MaximumHealth)")]
[Tooltip("初始化时赋予给 CurrentGeneralAttributes 的属性Value 填写对应 GeneralAttributes 的 Key 名,或直接填浮点数,留空默认为 0。")]
public SerializedDictionary<string, string> runtimeGeneralAttributes = new SerializedDictionary<string, string>();
// ── View ──────────────────────────────────────────────────────────────
[TabGroup("Data", "视图"), PropertyOrder(30)]
[LabelText("战斗位置顺序")]
[MinValue(0)]
public int combatPositionOrder;
[TabGroup("Data", "视图"), PropertyOrder(31)]
[LabelText("战斗角色视图 Prefab")]
public GameObject combatCharacterView;
[TabGroup("Data", "视图"), PropertyOrder(32)]
[DictionaryDrawerSettings(KeyLabel = "动画名称", ValueLabel = "AnimationClip")]
[LabelText("动画映射")]
public SerializableDictionary<string, AnimationClip> animations;
// ── 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> initialDeckRef;
[TabGroup("Data", "引用"), PropertyOrder(44)]
[ListDrawerSettings(ShowIndexLabels = false, DraggableItems = false)]
[ValueDropdown("GetAvailableHUDData", AppendNextDrawer = true)]
[Tooltip("HUD 信息引用列表")]
[LabelText("HUD 数据引用")]
public List<string> hudDataRefs;
}
// ─────────────────────────────────────────────────────────────────────────
// Runtime: 数据库查询
// ─────────────────────────────────────────────────────────────────────────
public partial class CharacterData
{
/// <summary>
/// 通过 DataID 从 ModManager 数据库查找 CharacterData。
/// </summary>
public static CharacterData Get(string dataID)
{
return ModManager.GetData<CharacterData>(dataID);
}
}
}