using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace StrategicCombat.MenuScreens
{
    /// <summary>
    /// A message screen that describes the controls in this game.
    /// </summary>
    public class GamePadControlScreen : InformationScreen
    {
        #region Variables

        // Textures
        public Texture2D dPadUpTexture;
        public Texture2D dPadDownTexture;
        public Texture2D dPadLeftTexture;
        public Texture2D dPadRightTexture;
        public Texture2D leftStickUpTexture;
        public Texture2D leftStickDownTexture;
        public Texture2D leftStickLeftTexture;
        public Texture2D leftStickRightTexture;
        public Texture2D rightStickLeftTexture;
        public Texture2D rightStickRightTexture;
        public Texture2D rightTriggerTexture;
        public Texture2D aButtonTexture;
        public Texture2D startButtonTexture;

        // Strings
        String moveUpString = "Move up on the board or in a combat (Dpad up or Left Stick up).";
        String moveDownString = "Move down on the board or in a combat (Dpad down or Left Stick down).";
        String moveLeftString = "Move left on the board or in a combat (Dpad left or Left Stick left).";
        String moveRightString = "Move right on the board or in a combat (Dpad right or Left Stick right).";
        String rotateLeftString = "Rotate to the left in a combat (Right Stick left).";
        String rotateRightString = "Rotate to the right in a combat (Right Stick right).";
        String selectOnBoardString = "Select a combat unit on the board (A button).";
        String shotString = "Shot in a combat (Right Trigger).";
        String pauseString = "Pause the game on the board or in a combat (Start button).";

        #endregion

        #region Constructors

        /// <summary>
        /// Create a new gamepad control screen.
        /// </summary>
        public GamePadControlScreen()
        {
            this.title = Resources.GamePadControl;

            this.message = "";

        }

        /// <summary>
        /// Loads specific graphics content used by the screen.
        /// </summary>
        public override void LoadSpecificContent()
        {
            // Create a new content manager.
            ContentManager content = ScreenManager.Game.Content;

            // Load power up textures
            this.dPadUpTexture = content.Load<Texture2D>("MenuAssets/dpadu");
            this.dPadDownTexture = content.Load<Texture2D>("MenuAssets/dpadd");
            this.dPadLeftTexture = content.Load<Texture2D>("MenuAssets/dpadl");
            this.dPadRightTexture = content.Load<Texture2D>("MenuAssets/dpadr");
            this.leftStickUpTexture = content.Load<Texture2D>("MenuAssets/lthumbu");
            this.leftStickDownTexture = content.Load<Texture2D>("MenuAssets/lthumbd");
            this.leftStickLeftTexture = content.Load<Texture2D>("MenuAssets/lthumbl");
            this.leftStickRightTexture = content.Load<Texture2D>("MenuAssets/lthumbr");
            this.rightStickLeftTexture = content.Load<Texture2D>("MenuAssets/rthumbl");
            this.rightStickRightTexture = content.Load<Texture2D>("MenuAssets/rthumbr");
            this.rightTriggerTexture = content.Load<Texture2D>("MenuAssets/rtrig");
            this.aButtonTexture = content.Load<Texture2D>("MenuAssets/a");
            this.startButtonTexture = content.Load<Texture2D>("MenuAssets/start");

        }

        #endregion

        #region Methods

        /// <summary>
        /// Draw specific information on this screen.
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="font"></param>
        public override void DrawSpecificInformation(SpriteBatch spriteBatch, SpriteFont font)
        {
            // Variables used to draw.
            Color shadowColor = Color.DarkGray * TransitionAlpha;
            Color foreColor = Color.White * TransitionAlpha;
            float scale = 1f;

            // Draw the message.
            spriteBatch.DrawString(font, this.message, new Vector2(xOffset + 6, yOffset + 101), Color.DarkGray * TransitionAlpha, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.message, new Vector2(xOffset + 5, yOffset + 100), Color.White * TransitionAlpha, 0, Vector2.Zero, 1, SpriteEffects.None, 0);

            // Draw move up
            spriteBatch.Draw(this.dPadUpTexture, new Vector2(xOffset + 10, yOffset + 90), foreColor);
            spriteBatch.Draw(this.leftStickUpTexture, new Vector2(xOffset + 43, yOffset + 90), foreColor);
            spriteBatch.DrawString(font, this.moveUpString, new Vector2(xOffset + 84, yOffset + 96), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.moveUpString, new Vector2(xOffset + 83, yOffset + 95), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw move down
            spriteBatch.Draw(this.dPadDownTexture, new Vector2(xOffset + 10, yOffset + 125), foreColor);
            spriteBatch.Draw(this.leftStickDownTexture, new Vector2(xOffset + 43, yOffset + 125), foreColor);
            spriteBatch.DrawString(font, this.moveDownString, new Vector2(xOffset + 84, yOffset + 131), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.moveDownString, new Vector2(xOffset + 83, yOffset + 130), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw move left
            spriteBatch.Draw(this.dPadLeftTexture, new Vector2(xOffset + 10, yOffset + 160), foreColor);
            spriteBatch.Draw(this.leftStickLeftTexture, new Vector2(xOffset + 43, yOffset + 160), foreColor);
            spriteBatch.DrawString(font, this.moveLeftString, new Vector2(xOffset + 84, yOffset + 166), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.moveLeftString, new Vector2(xOffset + 83, yOffset + 165), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw move right
            spriteBatch.Draw(this.dPadRightTexture, new Vector2(xOffset + 10, yOffset + 195), foreColor);
            spriteBatch.Draw(this.leftStickRightTexture, new Vector2(xOffset + 43, yOffset + 195), foreColor);
            spriteBatch.DrawString(font, this.moveRightString, new Vector2(xOffset + 84, yOffset + 201), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.moveRightString, new Vector2(xOffset + 83, yOffset + 200), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw rotate left
            spriteBatch.Draw(this.rightStickLeftTexture, new Vector2(xOffset + 10, yOffset + 230), foreColor);
            spriteBatch.DrawString(font, this.rotateLeftString, new Vector2(xOffset + 51, yOffset + 236), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.rotateLeftString, new Vector2(xOffset + 52, yOffset + 235), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw rotate right
            spriteBatch.Draw(this.rightStickRightTexture, new Vector2(xOffset + 10, yOffset + 265), foreColor);
            spriteBatch.DrawString(font, this.rotateRightString, new Vector2(xOffset + 51, yOffset + 271), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.rotateRightString, new Vector2(xOffset + 52, yOffset + 270), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw select on board
            spriteBatch.Draw(this.aButtonTexture, new Vector2(xOffset + 10, yOffset + 300), foreColor);
            spriteBatch.DrawString(font, this.selectOnBoardString, new Vector2(xOffset + 51, yOffset + 304), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.selectOnBoardString, new Vector2(xOffset + 52, yOffset + 303), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw shot in combat
            spriteBatch.Draw(this.rightTriggerTexture, new Vector2(xOffset + 10, yOffset + 335), foreColor);
            spriteBatch.DrawString(font, this.shotString, new Vector2(xOffset + 51, yOffset + 341), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.shotString, new Vector2(xOffset + 52, yOffset + 340), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);

            // Draw pause
            spriteBatch.Draw(this.startButtonTexture, new Vector2(xOffset + 10, yOffset + 370), foreColor);
            spriteBatch.DrawString(font, this.pauseString, new Vector2(xOffset + 51, yOffset + 376), shadowColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.DrawString(font, this.pauseString, new Vector2(xOffset + 52, yOffset + 375), foreColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);


        } // End of the DrawSpecificInformation method.

        #endregion

    } // End of class

} // End of namespace
