Resolve WES-49 "Courses list"
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user