Files
Cielonos/Assets/Scripts/MainGame/Items/Data/ContentData.cs

62 lines
1.5 KiB
C#
Raw Normal View History

2026-01-03 18:19:39 -05:00
using Sirenix.OdinInspector;
2025-12-17 04:19:38 -05:00
using UnityEngine;
2026-01-03 18:19:39 -05:00
namespace Cielonos.MainGame.Inventory
2025-12-17 04:19:38 -05:00
{
2026-01-03 18:19:39 -05:00
public enum ItemType
2025-12-17 04:19:38 -05:00
{
2026-01-03 18:19:39 -05:00
MainWeapon,
Support,
Passive,
Consumable
}
2025-12-17 04:19:38 -05:00
2026-01-03 18:19:39 -05:00
public enum ItemRarity
{
Tera,
Moser,
Graham,
Epsilon,
Aleph
2025-12-17 04:19:38 -05:00
}
2026-01-03 18:19:39 -05:00
[CreateAssetMenu(fileName = "ContentData", menuName = "Cielonos/Items/ContentData")]
public partial class ContentData : SerializedScriptableObject
2025-12-17 04:19:38 -05:00
{
2026-01-03 18:19:39 -05:00
[InlineButton("CreateID", "Create")]
public string className;
2025-12-17 04:19:38 -05:00
2026-01-03 18:19:39 -05:00
[ReadOnly]
public string displayNameKey;
[ReadOnly]
public string descriptionKey;
public ItemType itemType;
public ItemRarity itemRarity;
[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";
}
2025-12-17 04:19:38 -05:00
}
2026-01-03 18:19:39 -05:00
}