overmelted/Assets/ConjureOS/Scripts/MetadataWindow/ConjureArcadeMetadata.cs

118 lines
4.4 KiB
C#

#if UNITY_EDITOR
using System;
using UnityEngine;
namespace ConjureOS.MetadataWindow
{
[Serializable]
public class ConjureArcadeMetadata : ScriptableObject
{
// Save location
public const string MetadataAssetPath = "Assets/ConjureOS/Scripts/MetadataWindow/ConjureArcadeMetadata.asset";
// Properties Validation
public const int GameTitleLimit = 100;
public const int DescriptionLimit = 250;
public const int DevelopersNameLimit = 100;
public const int MaxSelectedGenres = 3;
public const float MaxThumbnailFileSize = 1024; // In Kb
public const float MaxGameplayImageFileSize = 1024; // In Kb
public static readonly float[] RequiredThumbnailAR = { 16f, 9f }; // Aspect Ratio
public static readonly float[] RequiredGameplayImageAR = { 1f, 1f }; // Aspect Ratio
public static readonly string[] GenreOptions =
{
"Platformer", "Shooter", "Fighting", "Beat 'em up", "Stealth", "Survival",
"Rhythm", "Horror", "Metroidvania", "Puzzle", "RPG", "Roguelike",
"Simulation", "Strategy", "Action", "Adventure", "RTS", "MOBA",
"Battle Royale", "Racing", "Sports", "Board", "Idle", "Trivia",
"Art", "Educational", "Sandbox", "Open World", "Other"
};
// Editable settings
[SerializeField, HideInInspector]
[Tooltip("The title of the game. Can't exceed 100 characters.")]
private string gameTitle;
public string GameTitle => gameTitle;
[SerializeField, HideInInspector]
[Tooltip("Current version of the game. Must follow the format 'x.x.x' where x are either numbers or letters.")]
private string version;
public string Version => version;
[SerializeField, HideInInspector]
[TextArea]
[Tooltip("Small description of the game. Can't exceed 250 characters.")]
private string description;
public string Description => description;
[SerializeField, HideInInspector]
[Tooltip("The minimum required number of players to play the game.")]
private int minNumPlayer = 1;
public int MinNumPlayer => minNumPlayer;
[SerializeField, HideInInspector]
[Tooltip("The maximum required number of players to play the game.")]
private int maxNumPlayer = 1;
public int MaxNumPlayer => maxNumPlayer;
[SerializeField, HideInInspector]
[Tooltip("Indicates if the game uses a leaderboard.")]
private bool useLeaderboard;
public bool UseLeaderboard => useLeaderboard;
[SerializeField, HideInInspector]
[Tooltip("Thumbnail image of the game. Displayed in the game selection screen. The image format must be 16:9, and its size can't exceed 1 MB.")]
private Texture2D thumbnail;
public Texture2D Thumbnail => thumbnail;
[SerializeField, HideInInspector]
[Tooltip("An image that shows what the game looks like. The image format must be 1:1, and its size can't exceed 1 MB.")]
private Texture2D gameplayImage;
public Texture2D GameplayImage => gameplayImage;
[SerializeField, HideInInspector]
[Tooltip("The names of the game developers.")]
private string[] developers;
public string[] Developers => developers;
[SerializeField, HideInInspector]
[Tooltip("Genres associated with the game.")]
private GameGenre[] genres;
public GameGenre[] Genres => genres;
// Uneditable settings
[SerializeField, HideInInspector]
private string id;
public string Id => id;
[SerializeField, HideInInspector]
private DateTime releaseDate;
public DateTime ReleaseDate => releaseDate;
[SerializeField, HideInInspector]
private DateTime lastGameUpdate;
public DateTime LastGameUpdate => lastGameUpdate;
/// <summary>
/// Updates all uneditable settings
/// </summary>
public void UpdateUneditableData()
{
// Generate GUID
if (string.IsNullOrEmpty(id))
{
id = Guid.NewGuid().ToString();
}
// Generate dates
if (releaseDate == DateTime.MinValue)
{
releaseDate = DateTime.Now;
}
lastGameUpdate = DateTime.Now;
}
}
}
#endif