using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
public class MainMenuControllerServer : MonoBehaviour
|
|
{
|
|
public GameObject MainMenu;
|
|
public GameObject SettingsMenu;
|
|
public GameObject AboutMenu;
|
|
public GameObject CreditsMenu;
|
|
|
|
public Button SoundButton;
|
|
public Button MusicButton;
|
|
public Button DifficultyButton;
|
|
public Button playerMovesButton;
|
|
|
|
//On Awake
|
|
private void Awake()
|
|
{
|
|
MainMenu.SetActive(true);
|
|
SettingsMenu.SetActive(false);
|
|
AboutMenu.SetActive(false);
|
|
CreditsMenu.SetActive(false);
|
|
}
|
|
|
|
//Main Menu Options
|
|
public void OnPlayClick()
|
|
{
|
|
UnityEngine.SceneManagement.SceneManager.LoadScene("Lobby");
|
|
}
|
|
public void OnQuitClick()
|
|
{
|
|
Application.Quit();
|
|
}
|
|
|
|
public void OnAboutClick()
|
|
{
|
|
//toggle which menu displays
|
|
MainMenu.SetActive(false);
|
|
AboutMenu.SetActive(true);
|
|
}
|
|
|
|
public void OnCreditClick()
|
|
{
|
|
//toggle which menu displays
|
|
MainMenu.SetActive(false);
|
|
CreditsMenu.SetActive(true);
|
|
}
|
|
|
|
public void OnSettingsClick()
|
|
{
|
|
//toggle which menu displays
|
|
MainMenu.SetActive(false);
|
|
SettingsMenu.SetActive(true);
|
|
}
|
|
|
|
//Settings Menu
|
|
public void OnBackSettingsClick ()
|
|
{
|
|
//Settings menu
|
|
SettingsMenu.SetActive (false);
|
|
MainMenu.SetActive (true);
|
|
}
|
|
|
|
public void OnBackAboutClick ()
|
|
{
|
|
//about menu
|
|
AboutMenu.SetActive (false);
|
|
MainMenu.SetActive (true);
|
|
}
|
|
|
|
public void OnBackCreditClick ()
|
|
{
|
|
//about menu
|
|
CreditsMenu.SetActive (false);
|
|
MainMenu.SetActive (true);
|
|
}
|
|
|
|
//Settings menu
|
|
public void OnMusicVolumeClick()
|
|
{
|
|
if (GlobalVariables.musicVolume == true)
|
|
{
|
|
//backgroundMusic.Stop();
|
|
MusicButton.GetComponentInChildren<Text>().text = "Music Volume: OFF";
|
|
GlobalVariables.musicVolume = false;
|
|
}
|
|
else
|
|
{
|
|
//backgroundMusic.Play();
|
|
MusicButton.GetComponentInChildren<Text>().text = "Music Volume: ON";
|
|
GlobalVariables.musicVolume = true;
|
|
}
|
|
}
|
|
|
|
//Settings menu
|
|
public void OnSoundVolumeClick ()
|
|
{
|
|
if (GlobalVariables.soundVolume == true) {
|
|
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
|
|
GlobalVariables.soundVolume = false;
|
|
} else {
|
|
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
|
|
GlobalVariables.soundVolume = true;
|
|
}
|
|
}
|
|
|
|
public void OnDifficultyClick()
|
|
{
|
|
if (GlobalVariables.difficulty == 1)
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: MEDIUM";
|
|
GlobalVariables.difficulty = 2;
|
|
}
|
|
else if (GlobalVariables.difficulty == 2)
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: HARD";
|
|
GlobalVariables.difficulty = 3;
|
|
}
|
|
else
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: EASY";
|
|
GlobalVariables.difficulty = 1;
|
|
}
|
|
}
|
|
|
|
public void OnDisplayPlayerMoves()
|
|
{
|
|
if (GlobalVariables.playerMoves == true)
|
|
{
|
|
playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: OFF";
|
|
GlobalVariables.playerMoves = false;
|
|
}
|
|
else
|
|
{
|
|
playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: ON";
|
|
GlobalVariables.playerMoves = true;
|
|
}
|
|
}
|
|
}
|