Esempio n. 1
0
        /// <summary>
        /// Updates the state of the menu
        /// </summary>
        /// <param name="gameTime">The gametime to use</param>
        public override void Update(GameTime gameTime)
        {
            if (isOptionsDisplayed)
            {
                if (optionsMenu.HasFocus)
                    optionsMenu.Update(gameTime);
                else
                {
                    isOptionsDisplayed = false;
                    hasFocus = true;
                    optionsMenu.Dispose();
                    optionsMenu = null;
                }
            }

            if (isCreditsDisplayed)
            {
                if (credits.HasFocus)
                    credits.Update(gameTime);
                else
                {
                    isCreditsDisplayed = false;
                    hasFocus = true;
                    credits.Dispose();
                    credits = null;
                    StaticBGM.SwitchMusic("Menu");

                    selectedNode = StartButton;
                    StartButton.IsSelected = true;
                    CreditsButton.IsSelected = false;
                }
            }

            base.Update(gameTime);
        }
Esempio n. 2
0
 /// <summary>
 /// Determines the action to be taken when a menu option is selected
 /// </summary>
 /// <param name="button">The button that was selected</param>
 protected override void Select(MenuNode button)
 {
     if (button == StartButton)
         callback(MenuCallbacks.NewGame);
     else if (button == LoadButton)
         callback(MenuCallbacks.LoadGame);
     else if (button == QuitButton)
         callback(MenuCallbacks.Quit);
     else if (button == OptionsButton)
     {
         optionsMenu = new OptionsMenu(gameSettings);
         isOptionsDisplayed = true;
         hasFocus = false;
     }
     else if (button == CreditsButton)
     {
         credits = new Credits();
         isCreditsDisplayed = true;
         hasFocus = false;
         StaticBGM.SwitchMusic("Credits");
     }
 }