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

64 lines
1.7 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;
/*
RectTransform rectTransform = newImage.GetComponent<RectTransform>();
rectTransform.localPosition = new Vector3(xPosition, yPosition, 0);
rectTransform.sizeDelta = new Vector2(width, height);
*/
}
// 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;
}
}