public void Update(GameTime gameTime)
 {
     gameUI.Update(gameTime);
     if (gameScreenStatus == GameScreenStatus.inPause)
     {
         pauseMenu.Update(gameTime);
     }
     else if (gameScreenStatus == GameScreenStatus.inGame)
     {
         if (GlobalControls.PausePressed() || PlayerControls.PausePressed(ControlsConfig.keyboardControllerIndex))
         {
             PauseGame();
         }
     }
 }
        public virtual void Update(GameTime gameTime)
        {
            if (GlobalControls.PausePressed())
            {
                BackPressed();
                Globals.soundEffectsManager.PlaySoundEffect(SoundEffects.MenuBack, false, SoundEffectsManager.zeroPanVectorLocation);
            }

            if (currentSubMenuScreenIndex >= 0)
            {
                subMenues[currentSubMenuScreenIndex].Update(gameTime);
            }
            else
            {
                if (GlobalControls.DeclinePressed())
                {
                    BackPressed();
                    Globals.soundEffectsManager.PlaySoundEffect(SoundEffects.MenuBack, false, SoundEffectsManager.zeroPanVectorLocation);
                }

                if (buttonList.Count > 0)
                {
                    if (GlobalControls.MenuDownPressed())
                    {
                        currentlySelectedButtonIndex++;
                        if (currentlySelectedButtonIndex >= buttonList.Count)
                        {
                            if (cycleOptions)
                            {
                                currentlySelectedButtonIndex = 0;
                            }
                            else
                            {
                                currentlySelectedButtonIndex = buttonList.Count - 1;
                            }
                        }

                        while (!buttonList[currentlySelectedButtonIndex].selectable)
                        {
                            currentlySelectedButtonIndex++;
                            if (currentlySelectedButtonIndex >= buttonList.Count)
                            {
                                if (cycleOptions)
                                {
                                    currentlySelectedButtonIndex = 0;
                                }
                                else
                                {
                                    currentlySelectedButtonIndex = LastSelectableButtonIndex();
                                }
                            }
                        }
                        Globals.soundEffectsManager.PlaySoundEffect(SoundEffects.MenuDown, false, SoundEffectsManager.zeroPanVectorLocation);
                    }

                    if (GlobalControls.MenuUpPressed())
                    {
                        currentlySelectedButtonIndex--;
                        if (currentlySelectedButtonIndex < 0)
                        {
                            if (cycleOptions)
                            {
                                currentlySelectedButtonIndex = buttonList.Count - 1;
                            }
                            else
                            {
                                currentlySelectedButtonIndex = 0;
                            }
                        }

                        while (!buttonList[currentlySelectedButtonIndex].selectable)
                        {
                            currentlySelectedButtonIndex--;
                            if (currentlySelectedButtonIndex < 0)
                            {
                                if (cycleOptions)
                                {
                                    currentlySelectedButtonIndex = buttonList.Count - 1;
                                }
                                else
                                {
                                    currentlySelectedButtonIndex = FirstSelectableButtonIndex();
                                }
                            }
                        }
                        Globals.soundEffectsManager.PlaySoundEffect(SoundEffects.MenuUp, false, SoundEffectsManager.zeroPanVectorLocation);
                    }

                    if (PlayerControls.MousePositionMoved())
                    {
                        for (int i = 0; i < buttonList.Count; i++)
                        {
                            if (buttonList[i].BoundingRect().Contains(PlayerControls.MousePosition()) && buttonList[i].selectable && buttonList[i].inScrollView)
                            {
                                currentlySelectedButtonIndex = i;
                            }
                        }
                    }

                    for (int i = 0; i < buttonList.Count; i++)
                    {
                        buttonList[i].selected = false;
                    }

                    if (currentlySelectedButtonIndex < buttonList.Count)
                    {
                        buttonList[currentlySelectedButtonIndex].selected = true;
                    }

                    for (int i = 0; i < buttonList.Count; i++)
                    {
                        buttonList[i].Update(gameTime);
                    }
                }
            }
        }