Resolve WES-49 "Courses list"

This commit is contained in:
Dries Van Schuylenbergh
2023-03-04 20:08:28 +00:00
parent 94e394b26c
commit ffa28e16dd
35 changed files with 6578 additions and 1525 deletions

View File

@@ -3,18 +3,22 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SceneManagement;
public class SpellingBeeThemeSelectionController : MonoBehaviour {
public class SpellingBeeThemeSelectionController : MonoBehaviour
{
private int buttonHeight = 140;
private int buttonWidth = 600;
private int canvasWidth = 1920;
// Start is called before the first frame update
void Start() {
void Start()
{
ThemeList themeList = ThemeLoader.loadJson();
for (int i = 0; i < themeList.themes.Length; i++) {
for (int i = 0; i < themeList.themes.Length; i++)
{
Theme theme = themeList.themes[i];
// First, you need to create a new button game object
@@ -37,7 +41,7 @@ public class SpellingBeeThemeSelectionController : MonoBehaviour {
textObject.transform.SetParent(newButton.transform);
// Set the position of the button game object
int xPos = (int) (i % 2 == 0 ? canvasWidth * 0.25f : canvasWidth * 0.75f);
int xPos = (int)(i % 2 == 0 ? canvasWidth * 0.25f : canvasWidth * 0.75f);
int yPos = (1 + i / 2) * 180;
newButton.transform.position = new Vector2(xPos, yPos);
@@ -55,8 +59,9 @@ public class SpellingBeeThemeSelectionController : MonoBehaviour {
}
}
void OnButtonClick(string clickedTheme) {
void OnButtonClick(string clickedTheme)
{
PlayerPrefs.SetString("themeName", clickedTheme);
ChangeSceneOnClick.loadScene("SpellingBee");
SceneManager.LoadScene("SpellingBee");
}
}