using Otter;
using System.Collections.Generic;

namespace PpbbffttMiningHa.entities.Controllers
{
    class Controllers
    {
        public static Dictionary<string, string> PlayerOneKeys = new Dictionary<string, string>();
        public static Dictionary<string, string> PlayerTwoKeys = new Dictionary<string, string>();
        public static Dictionary<string, string> PlayerThreeKeys = new Dictionary<string, string>();
        public static Dictionary<string, string> PlayerFourKeys = new Dictionary<string, string>();
        public static Dictionary<string, string> PausePersonKeys = new Dictionary<string, string>();

        public Controllers()
        {
            AddPlayerOneKeys();
            AddPlayerTwoKeys();
            AddPlayerThreeKeys();
            AddPlayerFourKeys();
            AddPausePersonKeys();
        }
        //pass in the string version of the key, return the actual ENUM of the key.
        public static int TranslateInputKeysForInts(string key)
        {
            switch (key)
            {
                case "MouseButton.Left":
                    return (int)MouseButton.Left;
                case "MouseButton.Right":
                    return (int)MouseButton.Right;
                case "MouseButton.Middle":
                    return (int)MouseButton.Middle;
                case "MouseButton.XButton1":
                    return (int)MouseButton.XButton1;
                case "MouseButton.XButton2":
                    return (int)MouseButton.XButton2;
                case "MouseButton.ButtonCount":
                    return (int)MouseButton.ButtonCount;
                case "Key.Unknown":
                    return (int)Key.Unknown;
                case "Key.A":
                    return (int)Key.A;
                case "Key.B":
                    return (int)Key.B;
                case "Key.C":
                    return (int)Key.C;
                case "Key.D":
                    return (int)Key.D;
                case "Key.E":
                    return (int)Key.E;
                case "Key.F":
                    return (int)Key.F;
                case "Key.G":
                    return (int)Key.G;
                case "Key.H":
                    return (int)Key.H;
                case "Key.I":
                    return (int)Key.I;
                case "Key.J":
                    return (int)Key.J;
                case "Key.K":
                    return (int)Key.K;
                case "Key.L":
                    return (int)Key.L;
                case "Key.M":
                    return (int)Key.M;
                case "Key.N":
                    return (int)Key.N;
                case "Key.O":
                    return (int)Key.O;
                case "Key.P":
                    return (int)Key.P;
                case "Key.Q":
                    return (int)Key.Q;
                case "Key.R":
                    return (int)Key.R;
                case "Key.S":
                    return (int)Key.S;
                case "Key.T":
                    return (int)Key.T;
                case "Key.U":
                    return (int)Key.U;
                case "Key.V":
                    return (int)Key.V;
                case "Key.W":
                    return (int)Key.W;
                case "Key.X":
                    return (int)Key.X;
                case "Key.Y":
                    return (int)Key.Y;
                case "Key.Z":
                    return (int)Key.Z;
                case "Key.Num0":
                    return (int)Key.Num0;
                case "Key.Num1":
                    return (int)Key.Num1;
                case "Key.Num2":
                    return (int)Key.Num2;
                case "Key.Num3":
                    return (int)Key.Num3;
                case "Key.Num4":
                    return (int)Key.Num4;
                case "Key.Num5":
                    return (int)Key.Num5;
                case "Key.Num6":
                    return (int)Key.Num6;
                case "Key.Num7":
                    return (int)Key.Num7;
                case "Key.Num8":
                    return (int)Key.Num8;
                case "Key.Num9":
                    return (int)Key.Num9;
                case "Key.Escape":
                    return (int)Key.Escape;
                case "Key.LControl":
                    return (int)Key.LControl;
                case "Key.LShift":
                    return (int)Key.LShift;
                case "Key.LAlt":
                    return (int)Key.LAlt;
                case "Key.LSystem":
                    return (int)Key.LSystem;
                case "Key.RControl":
                    return (int)Key.RControl;
                case "Key.RShift":
                    return (int)Key.RShift;
                case "Key.RAlt":
                    return (int)Key.RAlt;
                case "Key.RSystem":
                    return (int)Key.RSystem;
                case "Key.Menu":
                    return (int)Key.Menu;
                case "Key.LBracket":
                    return (int)Key.LBracket;
                case "Key.RBracket":
                    return (int)Key.RBracket;
                case "Key.SemiColon":
                    return (int)Key.SemiColon;
                case "Key.Comma":
                    return (int)Key.Comma;
                case "Key.Period":
                    return (int)Key.Period;
                case "Key.Quote":
                    return (int)Key.Quote;
                case "Key.Slash":
                    return (int)Key.Slash;
                case "Key.BackSlash":
                    return (int)Key.BackSlash;
                case "Key.Tilde":
                    return (int)Key.Tilde;
                case "Key.Equal":
                    return (int)Key.Equal;
                case "Key.Dash":
                    return (int)Key.Dash;
                case "Key.Space":
                    return (int)Key.Space;
                case "Key.Return":
                    return (int)Key.Return;
                case "Key.Back":
                    return (int)Key.Back;
                case "Key.Tab":
                    return (int)Key.Tab;
                case "Key.PageUp":
                    return (int)Key.PageUp;
                case "Key.PageDown":
                    return (int)Key.PageDown;
                case "Key.End":
                    return (int)Key.End;
                case "Key.Home":
                    return (int)Key.Home;
                case "Key.Insert":
                    return (int)Key.Insert;
                case "Key.Delete":
                    return (int)Key.Delete;
                case "Key.Add":
                    return (int)Key.Add;
                case "Key.Subtract":
                    return (int)Key.Subtract;
                case "Key.Multiply":
                    return (int)Key.Multiply;
                case "Key.Divide":
                    return (int)Key.Divide;
                case "Key.Left":
                    return (int)Key.Left;
                case "Key.Right":
                    return (int)Key.Right;
                case "Key.Up":
                    return (int)Key.Up;
                case "Key.Down":
                    return (int)Key.Down;
                case "Key.Numpad0":
                    return (int)Key.Numpad0;
                case "Key.Numpad1":
                    return (int)Key.Numpad1;
                case "Key.Numpad2":
                    return (int)Key.Numpad2;
                case "Key.Numpad3":
                    return (int)Key.Numpad3;
                case "Key.Numpad4":
                    return (int)Key.Numpad4;
                case "Key.Numpad5":
                    return (int)Key.Numpad5;
                case "Key.Numpad6":
                    return (int)Key.Numpad6;
                case "Key.Numpad7":
                    return (int)Key.Numpad7;
                case "Key.Numpad8":
                    return (int)Key.Numpad8;
                case "Key.Numpad9":
                    return (int)Key.Numpad9;
                case "Key.F1":
                    return (int)Key.F1;
                case "Key.F2":
                    return (int)Key.F2;
                case "Key.F3":
                    return (int)Key.F3;
                case "Key.F4":
                    return (int)Key.F4;
                case "Key.F5":
                    return (int)Key.F5;
                case "Key.F6":
                    return (int)Key.F6;
                case "Key.F7":
                    return (int)Key.F7;
                case "Key.F8":
                    return (int)Key.F8;
                case "Key.F9":
                    return (int)Key.F9;
                case "Key.F10":
                    return (int)Key.F10;
                case "Key.F11":
                    return (int)Key.F11;
                case "Key.F12":
                    return (int)Key.F12;
                case "Key.F14":
                    return (int)Key.F14;
                case "Key.F15":
                    return (int)Key.F15;
                case "Key.Pause":
                    return (int)Key.Pause;
                case "Key.KeyCount":
                    return (int)Key.KeyCount;
                case "JoyButtonA":
                    return 0;
                case "JoyButtonB":
                    return 1;
                case "JoyButtonX":
                    return 2;
                case "JoyButtonY":
                    return 3;
                case "JoyButtonLB":
                    return 4;
                case "JoyButtonRB":
                    return 5;
                case "JoyButtonBack":
                    return 6;
                case "JoyButtonStart":
                    return 7;
                case "JoyButtonLSC":
                    return 8;
                case "JoyButtonRSC":
                    return 9;
                case "JoyButton10":
                    return 10;
                case "JoyButton11":
                    return 11;
                case "JoyButton12":
                    return 12;
                case "JoyButton13":
                    return 13;
                case "JoyButton14":
                    return 14;
                case "JoyButton15":
                    return 15;
                case "JoyAxis0":
                    return 100;
                case "JoyAxis1":
                    return 101;
                case "JoyAxis2":
                    return 102;
                case "JoyAxis3":
                    return 103;
                case "JoyAxis4":
                    return 104;
                case "JoyAxis5":
                    return 105;
                case "JoyAxis6":
                    return 106;
                case "JoyAxis7":
                    return 107;
                case "JoyAxis8":
                    return 108;
                case "JoyAxis9":
                    return 109;
                case "JoyAxis10":
                    return 110;
                case "JoyAxis11":
                    return 111;
                case "JoyAxis12":
                    return 112;
                case "JoyAxis13":
                    return 113;
                case "JoyAxis14":
                    return 114;
                case "JoyAxis15":
                    return 115;
                case "Key.Any":
                    return (int)Key.Any;
                default:
                    return (int)Key.Unknown;
            }
        }

        public static void AddPlayerOneKeys()
        {
            PlayerOneKeys.Add("P1Up", "Key.W");
            PlayerOneKeys.Add("P1Down", "Key.S");
            PlayerOneKeys.Add("P1Left", "Key.A");
            PlayerOneKeys.Add("P1Right", "Key.D");
            PlayerOneKeys.Add("P1Fire", "Key.Z");
            PlayerOneKeys.Add("P1Jump", "Key.X");
            PlayerOneKeys.Add("P1Start", "Key.Return");
            PlayerOneKeys.Add("P1Mute", "Key.M");
            PlayerOneKeys.Add("P1Testing", "Key.R");
            PlayerOneKeys.Add("P1Testing2", "Key.Q");
            PlayerOneKeys.Add("P1Escape", "Key.Escape");
            PlayerOneKeys.Add("P1JoystickNumber", "0");
        }

        public static void AddPlayerTwoKeys()
        {
            PlayerTwoKeys.Add("P2Up", "Key.Numpad5");
            PlayerTwoKeys.Add("P2Down", "Key.Numpad2");
            PlayerTwoKeys.Add("P2Left", "Key.Numpad1");
            PlayerTwoKeys.Add("P2Right", "Key.Numpad3");
            PlayerTwoKeys.Add("P2Fire", "Key.Subtract");
            PlayerTwoKeys.Add("P2Jump", "Key.Multiply");
            PlayerTwoKeys.Add("P2JoystickNumber", "1");
        }

        public static void AddPlayerThreeKeys()
        {
            PlayerThreeKeys.Add("P3Up", "Key.Up");
            PlayerThreeKeys.Add("P3Down", "Key.Down");
            PlayerThreeKeys.Add("P3Left", "Key.Left");
            PlayerThreeKeys.Add("P3Right", "Key.Right");
            PlayerThreeKeys.Add("P3Fire", "Key.Slash");
            PlayerThreeKeys.Add("P3Jump", "Key.RShift");
            PlayerThreeKeys.Add("P3JoystickNumber", "2");
        }

        public static void AddPlayerFourKeys()
        {
            PlayerFourKeys.Add("P4Up", "Key.G");
            PlayerFourKeys.Add("P4Down", "Key.B");
            PlayerFourKeys.Add("P4Left", "Key.V");
            PlayerFourKeys.Add("P4Right", "Key.N");
            PlayerFourKeys.Add("P4Fire", "Key.Comma");
            PlayerFourKeys.Add("P4Jump", "Key.Period");
            PlayerFourKeys.Add("P4JoystickNumber", "3");
        }

        public static void AddPausePersonKeys()
        {
            PausePersonKeys.Add("PPUp", "Key.W");
            PausePersonKeys.Add("PPDown", "Key.S");
            PausePersonKeys.Add("PPLeft", "Key.A");
            PausePersonKeys.Add("PPRight", "Key.D");
            PausePersonKeys.Add("PPFire", "Key.Z");
            PausePersonKeys.Add("PPJump", "Key.X");
            PausePersonKeys.Add("PPStart", "Key.Return");
            PausePersonKeys.Add("PPMute", "Key.M");
            PausePersonKeys.Add("PPTesting", "Key.R");
            PausePersonKeys.Add("PPTesting2", "Key.Q");
            PausePersonKeys.Add("PPEscape", "Key.Escape");
            PausePersonKeys.Add("PPJoystickNumber", "0");
        }
    }
}
