﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Game_Algo
{
    static class GameSetting
    {
        static public Point PlayerStartPosition = new Point(26, 1);

        static public List<Point> PlayerPrisonCell
        {
            get
            {
                List<Point> playerPrisonCell = new List<Point>();
                playerPrisonCell.Add(new Point(26, 1));
                playerPrisonCell.Add(new Point(27, 1));
                playerPrisonCell.Add(new Point(28, 1));
                playerPrisonCell.Add(new Point(26, 2));
                playerPrisonCell.Add(new Point(27, 2));
                playerPrisonCell.Add(new Point(28, 2));
                return playerPrisonCell;
            }
        }

        static public Vector2 PlayerSpeed = new Vector2(2, 2);
        static public Vector2 GuardSpeed = new Vector2(2, 2);

        static public Point MapSize = new Point(30, 20); // how many Tiles

        static public Point TileSize = new Point(30, 30); // Tile dimensions (30px x 30px)

        static public Texture2D TileTextureSheet;
        
        static public Point WindowSize
        {
            get
            {
                Point windowSize = Point.Zero;
                windowSize.X = TileSize.X * MapSize.X;
                windowSize.Y = TileSize.Y * MapSize.Y;
                return windowSize;
            }
        }

        public struct MapLayout
        {
            static public string Level_01 =
                "##############################" + // 0
                "#EEEEEEEE#   #   #   #   #   #" + // 1
                "#        #   #   #   #   #   #" + // 2
                "#        ###-###-###-###-###-#" + // 3
                "#        #                   #" + // 4
                "#        #                   #" + // 5
                "####--####  #####  ########-##" + // 6
                "#        #  #   #  #         #" + // 7
                "#        #  #   -  -         #" + // 8
                "#   ######  ##################" + // 9
                "#   #    #   #    #    #     #" + // 10
                "#   #    #   ####-####-####-##" + // 11
                "#   #    #                   #" + // 12
                "#   ###--#######--#---####   #" + // 13
                "#        #        #      #   #" + // 14
                "#        #        #      #-#-#" + // 15
                "#        #################   #" + // 16
                "#                            #" + // 17
                "#                            #" + // 18
                "##############################";  // 19
        }

        // forgot the data type for this is Enum, not struct
        // but oh well, its done
        public struct TileType
        {
            static public int Floor = 0;
            static public int Wall = 1;
            static public int Door = 2;
            static public int Exit = 3;

            static public int Yellow = 4;
            static public int Purple = 5;
            static public int Brown = 6;
        }

        public struct TileTypeChar
        {
            static public char Floor = ' ';
            static public char Wall = '#';
            static public char Door = '-';
            static public char Exit = 'E';
        }

        static public int GetTileTypeByChar(char tileTypeChar) 
        {
            if (tileTypeChar == TileTypeChar.Floor)
                return TileType.Floor;
            if (tileTypeChar == TileTypeChar.Wall)
                return TileType.Wall;
            if (tileTypeChar == TileTypeChar.Door)
                return TileType.Door;
            if (tileTypeChar == TileTypeChar.Exit)
                return TileType.Exit;

            return 0;
        }

        static public Vector2 ConvertPointToVector2(Point PointOnMap)
        {
            return new Vector2(PointOnMap.X * TileSize.X, PointOnMap.Y * TileSize.Y);
        }
    }
}
