#region File Description
//-----------------------------------------------------------------------------
// OptionsMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System;

#endregion

#region Using Statements
using Microsoft.Xna.Framework;
#endregion

namespace GhostArena5
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class DifficultyScreen : MenuScreen
    {
        /// <summary>
        /// Constructor populates the menu with empty strings: the real values
        /// are filled in by the Update method to reflect the changing settings.
        /// </summary>
        public DifficultyScreen()
        {
        }

        public override void Initialize()
        {
            string[] names = ((Game1)ScreenManager.Game).Difficulty.GetDifficultyNames();

            foreach (string item in names)
            {
                _menuEntries.Add(item);
            }

            _menuEntries.Add("Back");

            base.Initialize();
        }
        /// <summary>
        /// Updates the options screen, filling in the latest values for the menu text.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }


        /// <summary>
        /// Responds to user menu selections.
        /// </summary>
        protected override void OnSelectEntry(int entryIndex)
        {
            switch (entryIndex)
            {
                case 0:
                case 1:
                case 2:

                    foreach (GameScreen screen in ScreenManager.GetScreens())
                        screen.ExitScreen();

                    ScreenManager.AddScreen(new GameplayScreen(entryIndex));

                    break;
                    
                case 3:
                    // Go back to the main menu.
                    ExitScreen();
                    break;
            }
        }


        /// <summary>
        /// When the user cancels the options screen, go back to the main menu.
        /// </summary>
        protected override void OnCancel()
        {
            ExitScreen();
        }
    }
}
