void OnGUI() { GUI.skin.settings.cursorColor = Color.black; newName = GUI.TextField(Name.AnchoredRect(), newName, 25, Name.style); if (GUI.Button(Back.AnchoredRect(), Back.content, Back.style)) { audio.Play(); MenuController.ChangeMenu(Back.menuObject, this.gameObject); } GUI.enabled = newName.Length > 2; if (GUI.Button(Submit.AnchoredRect(), Submit.content, Submit.style)) { audio.Play(); Player newPlayer = new Player(newName); playerData.playerData.players.Add(newPlayer); playerData.playerData.setCurrentPlayer(newName); playerData.CurrentLevel = 0; playerData.CurrentPlayer = playerData.playerData.players[playerData.playerData.players.Count - 1]; playerData.SaveData(); newName = ""; MenuController.ChangeMenu(Submit.menuObject, this.gameObject); } }
void OnGUI() { bool noob = playerData.CurrentPlayer.progress.Level[0].puzzle[0].puzzleRuns.Count == 0; if (GUI.Button(NewGame.AnchoredRect(), NewGame.content, NewGame.style)) { audio.Play(); if (!noob) { if (EditorUtility.DisplayDialog( "Warning!", "This will erase ALL your progress! This cannot be undone!", "Confirm", "Cancel") ) { playerData.ResetLevels(); puzzleParser.currentPuzzle = puzzleParser.allPuzzles.levels[0].puzzles[0]; Application.LoadLevel("Convo"); } } else { puzzleParser.currentPuzzle = puzzleParser.allPuzzles.levels[0].puzzles[0]; Application.LoadLevel("Convo"); } } GUI.enabled = !noob; if (GUI.Button(Resume.AnchoredRect(), Resume.content, Resume.style)) { audio.Play(); puzzleParser.currentPuzzle = NextPuzzle(); Application.LoadLevel("Game"); } GUI.enabled = true; if (GUI.Button(Back.AnchoredRect(), Back.content, Back.style)) { audio.Play(); MenuController.ChangeMenu(Back.menuObject, this.gameObject); } if (GUI.Button(BeginnerLevels.AnchoredRect(), BeginnerLevels.content, BeginnerLevels.style)) { audio.Play(); levelMenuGUI.level = 0; MenuController.ChangeMenu(LevelMenuObject, this.gameObject); } GUI.enabled = playerData.CurrentPlayer.progress.Level[2].puzzle[9].puzzleRuns.Count > 0; if (GUI.Button(IntermediateLevels.AnchoredRect(), IntermediateLevels.content, IntermediateLevels.style)) { audio.Play(); levelMenuGUI.level = 1; MenuController.ChangeMenu(LevelMenuObject, this.gameObject); } GUI.enabled = playerData.CurrentPlayer.progress.Level[5].puzzle[11].puzzleRuns.Count > 0; if (GUI.Button(AdvancedLevels.AnchoredRect(), AdvancedLevels.content, AdvancedLevels.style)) { audio.Play(); levelMenuGUI.level = 2; MenuController.ChangeMenu(LevelMenuObject, this.gameObject); } }