using KellysMarvelousAdventure.UI;
using KellysMarvelousAdventure.Utilities;
using Otter;

namespace KellysMarvelousAdventure
{
    class WinScreen : Scene
    {
        public Image winImage = new Image(Assets.WINSCREEN);

        public WinScreen()
        {
            AddGraphic(winImage);
            AddScore();
            AddClicks();
            AddKills();
            SoundManager.PlayRequestedSound("_girlWhatDidYouKnew");
        }

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

        private void AddScore()
        {
            string author = Global.score.ToString();
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(271 + y, 186, author[i].ToString(), Color.Green, 2f));
                Add(new Numbers(270 + y, 185, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }

        private void AddClicks()
        {
            string author = Global.Clicks.ToString();
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(271 + y, 231, author[i].ToString(), Color.Green, 2f));
                Add(new Numbers(270 + y, 230, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }

        private void AddKills()
        {
            string author = Global.kills.ToString();
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(271 + y, 275, author[i].ToString(), Color.Green, 2f));
                Add(new Numbers(270 + y, 274, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }
        private void AddShips()
        {
            string author = Global.NumberOfShips.ToString();
            var y = 0;
            for (var i = 0; i < author.Length; i++)
            {
                Add(new Numbers(271 + y, 335, author[i].ToString(), Color.Green, 2f));
                Add(new Numbers(270 + y, 334, author[i].ToString(), Color.White, 2f));
                y += 17;
            }
        }
    }
}



