Resolve WES-76 "87 themeselection"

This commit is contained in:
Lukas Van Rossem
2023-03-13 21:49:40 +00:00
parent 94ec7e0359
commit a267301ab6
23 changed files with 141 additions and 893 deletions

View File

@@ -0,0 +1,36 @@
using UnityEngine;
/// <summary>
/// JSON structure containing all themes/words
/// </summary>
[System.Serializable]
public class ThemeList
{
public Theme[] themes;
}
/// <summary>
/// Object representing part of the JSON containing word data
/// </summary>
[System.Serializable]
public class Theme
{
public string name;
public string description;
public string[] words;
}
/// <summary>
/// Loader of the themes-JSON
/// </summary>
public class ThemeLoader : MonoBehaviour
{
/// <summary>
/// Loads the JSON file containing all of the themes
/// </summary>
public static ThemeList LoadJson()
{
TextAsset themeJson = Resources.Load<TextAsset>("Common/words");
return JsonUtility.FromJson<ThemeList>(themeJson.text);
}
}