Add justsign to game list
This commit is contained in:
58
Assets/JustSign/Scripts/JustSignController.cs
Normal file
58
Assets/JustSign/Scripts/JustSignController.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user