using Otter;
using Puppyups.UI;
using Puppyups.Utilities;
using System;

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

        private Color colorOption;

        public WinScreen()
        {
            AddGraphic(TitleImage);
            for (var i = 0; i < 100; i++)
            {
                var randColor = Rand.Int(1, 3);
                if (randColor == 1)
                    colorOption = Color.Magenta;
                else if (randColor == 2)
                    colorOption = Color.Mix(Color.Blue, Color.Red);
                //WriteWord(Rand.Float(0, 360), Rand.Float(-20, 480), "dogggggggieeeeessssssssssss!!", colorOption, 1f, 1);
            }
            WriteWord(121, 101, "You Win!", Color.Gold, 2f, 1, 13);
            WriteWord(120, 100, "You Win!", Color.White, 2f, 1, 13);
            WriteWord(121, 151, "You Saved All The Doggies!", Color.Gold, 2f, 1, 13);
            WriteWord(120, 150, "You Saved All The Doggies!", Color.White, 2f, 1, 13);
            WriteWord(120, 300, "Press Enter to Title Screen", Color.Cyan, 2f, 1, 13);
        }

        public override void Update()
        {
            base.Update();
            if (Global.PlayerSession.Controller.Button("Start").Pressed)
            {
                Global.GAME.RemoveScene();
                Global.GAME.AddScene(new TitleScreen());
            }
        }

        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;
            }
        }
    }
}
