Files
Cielonos/Assets/Scripts/MainGame/Characters/Player/Items/Data/ContentData.cs
SoulliesOfficial f26f9fd374 爆更
2026-03-20 12:07:44 -04:00

83 lines
2.0 KiB
C#

using System.Collections.Generic;
using NUnit.Framework;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Cielonos.MainGame.Characters.Inventory
{
public enum ItemType
{
MainWeapon,
Support,
Passive,
Consumable
}
public enum ItemRarity
{
Tera,
Moser,
Graham,
Epsilon,
Aleph
}
[CreateAssetMenu(fileName = "ContentData", menuName = "Cielonos/Items/ContentData")]
public partial class ContentData : SerializedScriptableObject
{
[InlineButton("CreateID", "Create")]
public string className;
[ReadOnly]
public string displayNameKey;
[ReadOnly]
public string descriptionKey;
public ItemType itemType;
public ItemRarity itemRarity;
[ValueDropdown("GetAllTags", IsUniqueList = true, DropdownHeight = 400)]
public List<string> tags;
[ShowIf("isMainWeapon")]
public Sprite rectIcon;
[HideIf("isMainWeapon")]
public Sprite squareIcon;
}
public partial class ContentData
{
private bool isMainWeapon => itemType == ItemType.MainWeapon;
private void CreateID()
{
if(string.IsNullOrEmpty(this.className))
{
Debug.LogWarning("Class Name is empty. Cannot create Item ID.");
return;
}
string itemType = this.itemType.ToString();
string className = this.className;
displayNameKey = $"{itemType}_{className}_Name";
descriptionKey = $"{itemType}_{className}_Desc";
}
}
public partial class ContentData
{
#if UNITY_EDITOR
private List<string> GetAllTags()
{
return new List<string>
{
"Melee",
"Ranged",
"Burn",
"Freeze",
"Electric"
};
}
#endif
}
}