|
|
- using System.Collections;
- using System.Collections.Generic;
- 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;
-
- bool soundVolume = true;
- bool musicVolume = true;
- bool playerMoves = true;
- int difficulty = 1;
-
- //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 (musicVolume == true)
- {
- //backgroundMusic.Stop();
- MusicButton.GetComponentInChildren<Text>().text = "Music Volume: OFF";
- musicVolume = false;
- }
- else
- {
- //backgroundMusic.Play();
- MusicButton.GetComponentInChildren<Text>().text = "Music Volume: ON";
- musicVolume = true;
- }
- }
-
- //Settings menu
- public void OnSoundVolumeClick ()
- {
- if (soundVolume == true) {
- SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
- soundVolume = false;
- } else {
- SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
- soundVolume = true;
- }
- }
-
- public void OnDifficultyClick()
- {
- if (difficulty == 1)
- {
- DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: MEDIUM";
- difficulty = 2;
- }
- else if (difficulty == 2)
- {
- DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: HARD";
- difficulty = 3;
- }
- else
- {
- DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: EASY";
- difficulty = 1;
- }
- }
-
- public void OnDisplayPlayerMoves()
- {
- if (playerMoves == true)
- {
- playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: OFF";
- playerMoves = false;
- }
- else
- {
- playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: ON";
- playerMoves = true;
- }
- }
- }
|