Files
A-Fairytale-Gone-Bad-Briar-…/Assets/Scripts/Data/Identifiers/AssetKeyIdentifiers.cs

119 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
namespace BriarQueen.Data.Identifiers
{
public enum UIKey
{
None = 0,
InventorySlot,
CodexLocationButton,
CodexEntryButton
}
public enum SceneKey
{
None = 0,
MainMenuScene,
UIScene,
OpeningCinematicScene,
GameScene
}
[Serializable]
public enum LevelKey
{
None = 0,
ChapterOneArrivalRoad,
ChapterOneAshwickOutskirts,
ChapterOneInsideBrokenDownCar,
}
public enum AssetItemKey
{
None = 0,
}
public static class AssetKeyIdentifiers
{
private const string UI_PREFIX = "UI:";
private const string SCENE_PREFIX = "Scene:";
private const string LEVEL_PREFIX = "Level:";
private const string ITEM_PREFIX = "Item:";
public static string Get(UIKey key)
{
if (key == UIKey.None)
return string.Empty;
return $"{UI_PREFIX}{key}";
}
public static string Get(SceneKey key)
{
if (key == SceneKey.None)
return string.Empty;
return $"{SCENE_PREFIX}{key}";
}
public static string Get(LevelKey key)
{
if (key == LevelKey.None)
return string.Empty;
return $"{LEVEL_PREFIX}{key}";
}
public static string Get(AssetItemKey key)
{
if (key == AssetItemKey.None)
return string.Empty;
return $"{ITEM_PREFIX}{key}";
}
public static bool TryGet(UIKey key, out string value)
{
value = Get(key);
return !string.IsNullOrEmpty(value);
}
public static bool TryGet(SceneKey key, out string value)
{
value = Get(key);
return !string.IsNullOrEmpty(value);
}
public static bool TryGet(LevelKey key, out string value)
{
value = Get(key);
return !string.IsNullOrEmpty(value);
}
public static bool TryGet(AssetItemKey key, out string value)
{
value = Get(key);
return !string.IsNullOrEmpty(value);
}
public static IEnumerable<string> GetAllKeys()
{
foreach (UIKey key in Enum.GetValues(typeof(UIKey)))
if (key != UIKey.None)
yield return Get(key);
foreach (SceneKey key in Enum.GetValues(typeof(SceneKey)))
if (key != SceneKey.None)
yield return Get(key);
foreach (LevelKey key in Enum.GetValues(typeof(LevelKey)))
if (key != LevelKey.None)
yield return Get(key);
foreach (AssetItemKey key in Enum.GetValues(typeof(AssetItemKey)))
if (key != AssetItemKey.None)
yield return Get(key);
}
}
}