/// <summary> /// Enables the corresponding UI Menu depending on game's new state /// </summary> /// <param name="newGameState"></param> public void OnGameStateChange(GameStates newGameState) { if (!FilterUtils.CheckGameStateChange(gameplayData.currentState, newGameState)) { return; } Debug.Log("[UI_Manager] Game state changed to: " + newGameState); currentVisibleMenu.gameObject.SetActive(false); switch (newGameState) { case GameStates.MENU: mainMenuPanel.gameObject.SetActive(true); currentVisibleMenu = mainMenuPanel; break; case GameStates.SHOP: shopPanel.gameObject.SetActive(true); currentVisibleMenu = shopPanel; break; case GameStates.CREDITS: creditsPanel.gameObject.SetActive(true); currentVisibleMenu = creditsPanel; break; case GameStates.PRE_PLAY: prePlayMenuPanel.gameObject.SetActive(true); currentVisibleMenu = prePlayMenuPanel; break; case GameStates.FTUE: throw new System.NotImplementedException( "[UI Manager] FTUE Menu functionality" + "not implemented yet"); break; case GameStates.PLAYING: gameplayMenuPanel.gameObject.SetActive(true); currentVisibleMenu = gameplayMenuPanel; break; case GameStates.PAUSE: pauseMenuPanel.gameObject.SetActive(true); currentVisibleMenu = pauseMenuPanel; break; case GameStates.GAME_OVER: gameOverMenuPanel.gameObject.SetActive(true); currentVisibleMenu = gameOverMenuPanel; break; default: gameplayMenuPanel.gameObject.SetActive(true); currentVisibleMenu = gameplayMenuPanel; break; } }
public void Init(UserContext userContext) { UserContext = userContext; currentVisibleMenu = defaultMenuPanel; //Initialize sub panels that need user context: mainMenuPanel.Init(userContext); shopPanel.Init(userContext); songPlayingPanel.Init(userContext); gameOverMenuPanel.Init(userContext); }