You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
3.3 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine.UI;
  4. using UnityEngine;
  5. public class MainMenuControllerServer : MonoBehaviour
  6. {
  7. public GameObject MainMenu;
  8. public GameObject SettingsMenu;
  9. public GameObject AboutMenu;
  10. public GameObject CreditsMenu;
  11. public Button SoundButton;
  12. public Button MusicButton;
  13. public Button DifficultyButton;
  14. public Button playerMovesButton;
  15. //On Awake
  16. private void Awake()
  17. {
  18. MainMenu.SetActive(true);
  19. SettingsMenu.SetActive(false);
  20. AboutMenu.SetActive(false);
  21. CreditsMenu.SetActive(false);
  22. }
  23. //Main Menu Options
  24. public void OnPlayClick()
  25. {
  26. UnityEngine.SceneManagement.SceneManager.LoadScene("Lobby");
  27. }
  28. public void OnQuitClick()
  29. {
  30. Application.Quit();
  31. }
  32. public void OnAboutClick()
  33. {
  34. //toggle which menu displays
  35. MainMenu.SetActive(false);
  36. AboutMenu.SetActive(true);
  37. }
  38. public void OnCreditClick()
  39. {
  40. //toggle which menu displays
  41. MainMenu.SetActive(false);
  42. CreditsMenu.SetActive(true);
  43. }
  44. public void OnSettingsClick()
  45. {
  46. //toggle which menu displays
  47. MainMenu.SetActive(false);
  48. SettingsMenu.SetActive(true);
  49. }
  50. //Settings Menu
  51. public void OnBackSettingsClick ()
  52. {
  53. //Settings menu
  54. SettingsMenu.SetActive (false);
  55. MainMenu.SetActive (true);
  56. }
  57. public void OnBackAboutClick ()
  58. {
  59. //about menu
  60. AboutMenu.SetActive (false);
  61. MainMenu.SetActive (true);
  62. }
  63. public void OnBackCreditClick ()
  64. {
  65. //about menu
  66. CreditsMenu.SetActive (false);
  67. MainMenu.SetActive (true);
  68. }
  69. //Settings menu
  70. public void OnMusicVolumeClick()
  71. {
  72. if (GlobalVariables.musicVolume == true)
  73. {
  74. //backgroundMusic.Stop();
  75. MusicButton.GetComponentInChildren<Text>().text = "Music Volume: OFF";
  76. GlobalVariables.musicVolume = false;
  77. }
  78. else
  79. {
  80. //backgroundMusic.Play();
  81. MusicButton.GetComponentInChildren<Text>().text = "Music Volume: ON";
  82. GlobalVariables.musicVolume = true;
  83. }
  84. }
  85. //Settings menu
  86. public void OnSoundVolumeClick ()
  87. {
  88. if (GlobalVariables.soundVolume == true) {
  89. SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
  90. GlobalVariables.soundVolume = false;
  91. } else {
  92. SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
  93. GlobalVariables.soundVolume = true;
  94. }
  95. }
  96. public void OnDifficultyClick()
  97. {
  98. if (GlobalVariables.difficulty == 1)
  99. {
  100. DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: MEDIUM";
  101. GlobalVariables.difficulty = 2;
  102. }
  103. else if (GlobalVariables.difficulty == 2)
  104. {
  105. DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: HARD";
  106. GlobalVariables.difficulty = 3;
  107. }
  108. else
  109. {
  110. DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: EASY";
  111. GlobalVariables.difficulty = 1;
  112. }
  113. }
  114. public void OnDisplayPlayerMoves()
  115. {
  116. if (GlobalVariables.playerMoves == true)
  117. {
  118. playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: OFF";
  119. GlobalVariables.playerMoves = false;
  120. }
  121. else
  122. {
  123. playerMovesButton.GetComponentInChildren<Text>().text = "Display Player Moves: ON";
  124. GlobalVariables.playerMoves = true;
  125. }
  126. }
  127. }