#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Menu.GameLogic;
#endregion

namespace Menu.Screen
{
    // Classe qui permet d'afficher les state
    public abstract class GameState : WorldEntity
    {
        public double _lastEnter;

        public GameState(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY)
            : base(game, "Menu/"+nomTexture, posX, posY, sizeX, sizeY)
        {
            this.DrawOrder = 1;
        }

        public GameState(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, "Menu/"+nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 1;
        }

        public void changeStatutVisibleEnableOption(bool statut)
        {
            this.Enabled = statut;
            this.Visible = statut;
        }

        public void AddAndSetVisibleEnableOptionComponent(bool statut)
        {
            Game.Components.Add(this);
            this.Enabled = statut;
            this.Visible = statut;
        }
    }

    #region Screens
    public class IntroScreen : GameState
    {
        public IntroScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY)
            : base(game, nomTexture, posX, posY, sizeX, sizeY)
        {
            this.DrawOrder = 1;
        }

        public override void Update(GameTime gameTime)
        {

            #region enter
            if (Keyboard.GetState().IsKeyDown(Keys.Enter))
            {
                if (gameTime.TotalGameTime.TotalMilliseconds - _lastEnter > 150)
                {
                    // Quitte l'écran principal
                    this.Enabled = false;
                    this.Visible = false;

                    _lastEnter = gameTime.TotalGameTime.TotalMilliseconds;

                }

            }
            #endregion
            
            base.Update(gameTime);
        }


    }

    public class MenuScreen : GameState
    {
        public MenuScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY)
            : base(game, nomTexture, posX, posY, sizeX, sizeY)
        {
            this.DrawOrder = 1;
        }
    }
    #endregion

    #region OptionsComponentScreen
    public class OptionStoryModeScreen : GameState
    {
        public OptionStoryModeScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }
    }

    public class OptionSkirmishModeScreen : GameState
    {
        public OptionSkirmishModeScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class SkirmishModeScreen : GameState
    {
        public SkirmishModeScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionLibraryScreen : GameState
    {
        public OptionLibraryScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionMapEditorScreen : GameState
    {
        public OptionMapEditorScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionLoadGameScreen : GameState
    {
        public OptionLoadGameScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionOptionsScreen : GameState
    {
        public OptionOptionsScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionHighScoreScreen : GameState
    {
        public OptionHighScoreScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }

    public class OptionQuitScreen : GameState
    {
        public OptionQuitScreen(Game game, string nomTexture, float posX, float posY, float sizeX, float sizeY, Mode mode, Option option)
            : base(game, nomTexture, posX, posY, sizeX, sizeY, mode, option)
        {
            this.DrawOrder = 10;
        }
    }
    #endregion
}
