106 lines
3.4 KiB
C#
106 lines
3.4 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using Continentis.MainGame.Character;
|
||
using SLSFramework.General;
|
||
using UnityEngine;
|
||
using NaughtyAttributes;
|
||
using SLSFramework.UModAssistance;
|
||
using UnityEngine.Serialization;
|
||
|
||
#if UNITY_EDITOR
|
||
using UnityEditor;
|
||
#endif
|
||
|
||
namespace Continentis.MainGame.Card
|
||
{
|
||
public enum CardType
|
||
{
|
||
Attack = 0,
|
||
Skill = 10,
|
||
Power = 20,
|
||
Status = 30,
|
||
Curse = 40,
|
||
Item = 50,
|
||
}
|
||
|
||
[CreateAssetMenu(menuName = "Continentis/MainGame/Card/CardData", fileName = "CardData")]
|
||
public partial class CardData : ScriptableObject
|
||
{
|
||
[Header("Fundamental")]
|
||
public string modName;
|
||
public string categoryName;
|
||
public string className;
|
||
public string displayName;
|
||
public Rarity cardRarity;
|
||
public CardType cardType;
|
||
public List<string> keywords;
|
||
|
||
public Sprite cardSprite;
|
||
public List<string> cardLayoutTags;
|
||
|
||
public string functionText;
|
||
public string cardDescription;
|
||
|
||
[Header("Intention")]
|
||
public List<string> intentionIconKeys;
|
||
public List<string> intentionValueNames;
|
||
public string intentionTextOverride;
|
||
public float baseWeight = 0f;
|
||
|
||
[Header("Attributes")] [Tooltip("可变属性,这个属性会自动设置BaseAttr进入Original,设置Attr,BaseAttrOffset=0,以及DisplayAttr进入Current")]
|
||
public SerializableDictionary<string, float> variableAttributes = new SerializableDictionary<string, float>();
|
||
|
||
[Tooltip("基础属性,不会改变,通常情况下不会直接使用")]
|
||
public SerializableDictionary<string, float> originalAttributes = new SerializableDictionary<string, float>();
|
||
|
||
[FormerlySerializedAs("endowingCurrentAttributes")]
|
||
[Tooltip("初始化时赋予给CurrentAttributes的属性,第一栏是属性名,第二栏是初始化时使用对应名称的OriginalAttributes的,留空则默认为0,如果是float数字则直接使用该数字")]
|
||
public SerializableDictionary<string, string> runtimeCurrentAttributes = new SerializableDictionary<string, string>();
|
||
|
||
[Header("Upgrade")] public CardUpgradeNode upgradeNode;
|
||
|
||
[Header("References")] public List<string> prefabRefs = new List<string>();
|
||
public List<string> derivativeCardDataRefs = new List<string>();
|
||
public List<string> derivativeCharacterDataRefs = new List<string>();
|
||
}
|
||
|
||
public partial class CardData
|
||
{
|
||
public bool HasKeyword(string keyword)
|
||
{
|
||
return keywords.Contains(keyword);
|
||
}
|
||
}
|
||
|
||
public partial class CardData
|
||
{
|
||
public static CardData Get(string dataID)
|
||
{
|
||
return ModManager.GetData<CardData>(dataID);
|
||
}
|
||
}
|
||
|
||
public partial class CardData
|
||
{
|
||
|
||
/// <summary>
|
||
/// 通过索引获取衍生卡牌数据
|
||
/// </summary>
|
||
public CardData GetDerivativeCardData(int index)
|
||
{
|
||
return ModManager.GetData<CardData>(derivativeCardDataRefs[index]);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 通过索引获取衍生角色数据
|
||
/// </summary>
|
||
/// <param name="index"></param>
|
||
/// <returns></returns>
|
||
public CharacterData GetDerivativeCharacterData(int index)
|
||
{
|
||
return ModManager.GetData<CharacterData>(derivativeCharacterDataRefs[index]);
|
||
}
|
||
}
|
||
} |