Files
unity-application/Assets/JustSign/Scripts/JustSignController.cs
2023-03-16 00:02:41 +01:00

59 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JustSignController : MonoBehaviour
{
/// <summary>
/// All of the words that can be used in this session
/// </summary>
private string[] words;
/// <summary>
/// All of the available themes
/// </summary>
private ThemeList themeList;
/// <summary>
/// The theme we are currently using
/// </summary>
private Theme currentTheme;
// Start is called before the first frame update
void Start()
{
themeList = ThemeLoader.LoadJson();
currentTheme = FindThemeByName(PlayerPrefs.GetString("themeName"));
words = currentTheme.words;
}
// Update is called once per frame
void Update()
{
}
/// <summary>
/// Find the chosen theme by its name
/// </summary>
/// <param name="themeName">The name of the theme to find</param>
/// <returns>The requested theme</returns>
private Theme FindThemeByName(string themeName)
{
int themeIndex = 0;
while (themeIndex < themeList.themes.Length)
{
Theme theme = themeList.themes[themeIndex];
if (theme.name == themeName)
{
return theme;
}
themeIndex++;
}
Debug.Log("Requested theme not found");
return null;
}
}