using Otter;

namespace KellysMarvelousAdventure.UI
{
    class Numbers : Entity
    {
        private Spritemap<string> sprite;
        //this is the numbers class. yet, again.
        public string c = "";
        private float _xO = 0;
        private float _yO = 0;

        public Numbers(float x, float y, string charToDisplay, Color color, float scale = 1f, int layer = 1)
        {
            X = x;
            Y = y;
            c = charToDisplay;
            _xO = x;
            _yO = y;
            SetHitbox(16, 16, (int)Global.Type.NUMBERS);
            sprite = new Spritemap<string>(Assets.NUMBERS, 10, 10);
            addSprites();
            sprite.Play("12");
            sprite.Color = new Color(color);
            sprite.Scale = scale;
            Graphic = sprite;
            Layer = layer;
        }
        public override void Update()
        {
            base.Update();
            X = this.Scene.CameraX + _xO;
            Y = this.Scene.CameraY + _yO;
            if (c == "") sprite.Play("12");
            if (c == " ") sprite.Play("12");
            if (c == "0") sprite.Play("0");
            if (c == "1") sprite.Play("1");
            if (c == "2") sprite.Play("2");
            if (c == "3") sprite.Play("3");
            if (c == "4") sprite.Play("4");
            if (c == "5") sprite.Play("5");
            if (c == "6") sprite.Play("6");
            if (c == "7") sprite.Play("7");
            if (c == "8") sprite.Play("8");
            if (c == "9") sprite.Play("9");
            if (c == "cc") sprite.Play("10");
            if (c == "!") sprite.Play("11");
            if (c == "a") sprite.Play("13");
            if (c == "A") sprite.Play("13");
            if (c == "b") sprite.Play("14");
            if (c == "B") sprite.Play("14");
            if (c == "c") sprite.Play("15");
            if (c == "C") sprite.Play("15");
            if (c == "d") sprite.Play("16");
            if (c == "D") sprite.Play("16");
            if (c == "e") sprite.Play("17");
            if (c == "E") sprite.Play("17");
            if (c == "f") sprite.Play("18");
            if (c == "F") sprite.Play("18");
            if (c == "g") sprite.Play("19");
            if (c == "G") sprite.Play("19");
            if (c == "h") sprite.Play("20");
            if (c == "H") sprite.Play("20");
            if (c == "i") sprite.Play("21");
            if (c == "I") sprite.Play("21");
            if (c == "j") sprite.Play("22");
            if (c == "J") sprite.Play("22");
            if (c == "k") sprite.Play("23");
            if (c == "K") sprite.Play("23");
            if (c == "l") sprite.Play("24");
            if (c == "L") sprite.Play("24");
            if (c == "m") sprite.Play("25");
            if (c == "M") sprite.Play("25");
            if (c == "n") sprite.Play("26");
            if (c == "N") sprite.Play("26");
            if (c == "o") sprite.Play("27");
            if (c == "O") sprite.Play("27");
            if (c == "p") sprite.Play("28");
            if (c == "P") sprite.Play("28");
            if (c == "q") sprite.Play("29");
            if (c == "Q") sprite.Play("29");
            if (c == "r") sprite.Play("30");
            if (c == "R") sprite.Play("30");
            if (c == "s") sprite.Play("31");
            if (c == "S") sprite.Play("31");
            if (c == "t") sprite.Play("32");
            if (c == "T") sprite.Play("32");
            if (c == "u") sprite.Play("33");
            if (c == "U") sprite.Play("33");
            if (c == "v") sprite.Play("34");
            if (c == "V") sprite.Play("34");
            if (c == "w") sprite.Play("35");
            if (c == "W") sprite.Play("35");
            if (c == "x") sprite.Play("36");
            if (c == "X") sprite.Play("36");
            if (c == "y") sprite.Play("37");
            if (c == "Y") sprite.Play("37");
            if (c == "z") sprite.Play("38");
            if (c == "Z") sprite.Play("38");
        }
        public void addSprites()
        {
            sprite.Add("0", new int[] { 0 });
            sprite.Add("1", new int[] { 1 });
            sprite.Add("2", new int[] { 2 });
            sprite.Add("3", new int[] { 3 });
            sprite.Add("4", new int[] { 4 });
            sprite.Add("5", new int[] { 5 });
            sprite.Add("6", new int[] { 6 });
            sprite.Add("7", new int[] { 7 });
            sprite.Add("8", new int[] { 8 });
            sprite.Add("9", new int[] { 9 });
            sprite.Add("10", new int[] { 10 });
            sprite.Add("11", new int[] { 11 });
            sprite.Add("12", new int[] { 12 });
            sprite.Add("13", new int[] { 13 });
            sprite.Add("14", new int[] { 14 });
            sprite.Add("15", new int[] { 15 });
            sprite.Add("16", new int[] { 16 });
            sprite.Add("17", new int[] { 17 });
            sprite.Add("18", new int[] { 18 });
            sprite.Add("19", new int[] { 19 });
            sprite.Add("20", new int[] { 20 });
            sprite.Add("21", new int[] { 21 });
            sprite.Add("22", new int[] { 22 });
            sprite.Add("23", new int[] { 23 });
            sprite.Add("24", new int[] { 24 });
            sprite.Add("25", new int[] { 25 });
            sprite.Add("26", new int[] { 26 });
            sprite.Add("27", new int[] { 27 });
            sprite.Add("28", new int[] { 28 });
            sprite.Add("29", new int[] { 29 });
            sprite.Add("30", new int[] { 30 });
            sprite.Add("31", new int[] { 31 });
            sprite.Add("32", new int[] { 32 });
            sprite.Add("33", new int[] { 33 });
            sprite.Add("34", new int[] { 34 });
            sprite.Add("35", new int[] { 35 });
            sprite.Add("36", new int[] { 36 });
            sprite.Add("37", new int[] { 37 });
            sprite.Add("38", new int[] { 38 });
        }

        public void Destroy()
        {
            RemoveSelf();
        }
    }
}

