using Otter;
using Puppyups.scenes;
using Puppyups.UI;

namespace Puppyups.Scenes
{
    class TwoPlayerQuestion : Scene
    {
        public Image TitleImage = new Image(Assets.TITLESCREEN);

        private Color colorOption;

        public TwoPlayerQuestion()
        {
            AddGraphic(TitleImage);
            for (var i = 0; i < 100; i++)
            {
                var randColor = Rand.Int(1, 3);
                if (randColor == 1)
                    colorOption = Color.Mix(Color.Magenta, Color.Red);
                else if (randColor == 2)
                    colorOption = Color.Mix(Color.Blue, Color.Red);
                //WriteWord(Rand.Float(0, 360), Rand.Float(-20, 480), "Doggieeessssssssssssssssss!!", colorOption, 1f, 1);
            }
            WriteWord(123, 103, "Do You Want", Color.Blue, 5f, 1, 33);
            WriteWord(120, 100, "Do You Want", Color.White, 5f, 1, 33);
            WriteWord(123, 153, "Two Players", Color.Blue, 5f, 1, 33);
            WriteWord(120, 150, "Two Players", Color.White, 5f, 1, 33);
            WriteWord(43, 203, "CLICK ENTER FOR YES", Color.Blue, 4f, 1, 30);
            WriteWord(40, 200, "CLICK ENTER FOR YES", Color.White, 4f, 1, 30);
            WriteWord(23, 253, "CLICK SPACEBAR FOR NO", Color.Blue, 4f, 1, 30);
            WriteWord(20, 250, "CLICK SPACEBAR FOR NO", Color.White, 4f, 1, 30);
        }

        public override void Update()
        {
            base.Update();
            //Global.RunTracker();
            if (Global.PlayerSession.Controller.Button("Start").Pressed)
            {
                Global.IsTwoPlayerActive = true;
                Global.GAME.RemoveScene();
                Global.GAME.AddScene(new InLab());
            }
            if (Global.PlayerSession.Controller.Button("Space").Pressed)
            {
                Global.GAME.RemoveScene();
                Global.GAME.AddScene(new InLab());
            }
        }

        public void WriteWord(float x, float y, string word, Color color, float scale, int layer, int spacer = 10)
        {
            var a = 0;
            for (var i = 0; i < word.Length; i++)
            {
                Add(new Numbers(x + a, y, word[i].ToString(), color, scale, layer));
                a += spacer;
            }
        }
    }
}
