Theme selection screen
This commit is contained in:
@@ -34,7 +34,8 @@ public class SpellingBeeController : MonoBehaviour {
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
themeList = ThemeLoader.loadJson();
|
||||
currentTheme = themeList.themes[0];
|
||||
|
||||
currentTheme = findThemeByName(PlayerPrefs.GetString("themeName"));
|
||||
words = currentTheme.words;
|
||||
|
||||
SetRandomWord();
|
||||
@@ -60,6 +61,21 @@ public class SpellingBeeController : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Pick a new random word from words and initialize the needed variables
|
||||
void SetRandomWord() {
|
||||
currentIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user