/// <summary> /// Opens the game menu to the specified menu window. /// </summary> /// <param name="whichWindow"></param> public void OpenGameMenu(GameMenuWindow window) { if (window == GameMenuWindow.Inventory) { _activeWindow = new Inventory(); } else if (window == GameMenuWindow.AreaMap) { _activeWindow = new AreaMap(); } else if (window == GameMenuWindow.WorldMap) { _activeWindow = new WorldMap(); } IsGameMenuOpen = true; }
public void Update(float dt) { if (SMH.Input.IsPressed(Input.Pause)) { if (IsGameMenuOpen) { CloseWindow(); } else if (!IsWindowOpen) { OpenGameMenu(); } return; } //Handle input for scrolling through game menu windows if (IsGameMenuOpen) { if (SMH.Input.IsPressed(Input.PreviousAbility)) { if (_currentGameMenuWindow == GameMenuWindow.Inventory) { _currentGameMenuWindow = GameMenuWindow.WorldMap; } else if (_currentGameMenuWindow == GameMenuWindow.WorldMap) { _currentGameMenuWindow = GameMenuWindow.AreaMap; } else if (_currentGameMenuWindow == GameMenuWindow.AreaMap) { _currentGameMenuWindow = GameMenuWindow.Inventory; } OpenGameMenu(_currentGameMenuWindow); SMH.Sound.PlaySound(Sound.ChangeMenu); } else if (SMH.Input.IsPressed(Input.NextAbility)) { if (_currentGameMenuWindow == GameMenuWindow.Inventory) { _currentGameMenuWindow = GameMenuWindow.AreaMap; } else if (_currentGameMenuWindow == GameMenuWindow.AreaMap) { _currentGameMenuWindow = GameMenuWindow.WorldMap; } else if (_currentGameMenuWindow == GameMenuWindow.WorldMap) { _currentGameMenuWindow = GameMenuWindow.Inventory; } OpenGameMenu(_currentGameMenuWindow); SMH.Sound.PlaySound(Sound.ChangeMenu); } } //When the text box is open keep updating Smiley's tongue if (IsTextBoxOpen) { SMH.Player.Tongue.Update(dt); } //If the active window returns false, close it if (_activeWindow != null && !_activeWindow.Update(dt)) { CloseWindow(); } }