using GiraffeRoller.entities;
using GiraffeRoller.ui;
using GiraffeRoller.Utility;
using Otter;

namespace GiraffeRoller.scenes
{
    class Tutorial1 : Scene
    {
        public Image titleImage = new Image(Assets.TITLE_IMAGE);
        private bool one = true;

        public Tutorial1()
        {
            titleImage.ScaleY = 0.80f;
            AddGraphic(titleImage);

            Add(new Title(150, -460));
            Add(new PausePerson());
            SoundManager.PlayRequestedSound("_startGame");
        }

        public override void Update()
        {
            base.Update();
            if (!IsGroupPaused(0))
            {
                if (one)
                {
                    one = false;
                    string giraffeRoller = "How To Play";
                    var zzz = 0;
                    var ff = .1f;
                    for (var b = 0; b < giraffeRoller.Length; b++)
                    {
                        Add(new Numbers(50 + zzz, 50, giraffeRoller[b].ToString(), Color.Lerp(Color.Yellow, Color.Red, ff), .5f, 4f));
                        Add(new Numbers(50 + zzz, 50, giraffeRoller[b].ToString(), Color.Lerp(Color.Yellow, Color.Red, ff), .5f, 4f, 1, .5f));
                        Add(new Numbers(50 + zzz, 50, giraffeRoller[b].ToString(), Color.Lerp(Color.Yellow, Color.Red, ff), .5f, 4f, 1, .3f));
                        Add(new Numbers(50 + zzz, 50, giraffeRoller[b].ToString(), Color.Lerp(Color.Yellow, Color.Red, ff), .5f, 4f, 1, .1f));
                        zzz += 45;
                        ff += .05f;
                    }
                    string author = "use W A S D, to move;";
                    var f = .1f;
                    var y = 0;
                    for (var i = 0; i < author.Length; i++)
                    {
                        Add(new Numbers(250 + y, 150, author[i].ToString(), Color.Lerp(Color.Yellow, Color.Orange, f), .1f));
                        Add(new Numbers(250 + y, 150, author[i].ToString(), Color.Lerp(Color.Yellow, Color.Orange, f), .1f, 1, 1, .5f));
                        Add(new Numbers(250 + y, 150, author[i].ToString(), Color.Lerp(Color.Yellow, Color.Orange, f), .1f, 1, 1, .3f));
                        Add(new Numbers(250 + y, 150, author[i].ToString(), Color.Lerp(Color.Yellow, Color.Orange, f), .1f, 1, 1, .1f));
                        y += 10;
                        f += .05f;
                    }
                    string author2 = "Press fire to charge up your ROLL ATTACK";
                    var f2 = .1f;
                    var y2 = 0;
                    for (var i = 0; i < author2.Length; i++)
                    {
                        Add(new Numbers(200 + y2, 210, author2[i].ToString(), Color.Lerp(Color.Gold, Color.Yellow, f2), .1f));
                        Add(new Numbers(200 + y2, 210, author2[i].ToString(), Color.Lerp(Color.Gold, Color.Yellow, f2), .1f, 1, 1, .5f));
                        Add(new Numbers(200 + y2, 210, author2[i].ToString(), Color.Lerp(Color.Gold, Color.Yellow, f2), .1f, 1, 1, .3f));
                        Add(new Numbers(200 + y2, 210, author2[i].ToString(), Color.Lerp(Color.Gold, Color.Yellow, f2), .1f, 1, 1, .1f));
                        y2 += 10;
                        f2 += .05f;
                    }
                    string author22 = "Release fire to Unleash your ROLL ATTACK";
                    var f22 = .1f;
                    var y22 = 0;
                    for (var i = 0; i < author22.Length; i++)
                    {
                        Add(new Numbers(200 + y22, 260, author22[i].ToString(), Color.Lerp(Color.Yellow, Color.Gold, f22), .1f));
                        Add(new Numbers(200 + y22, 260, author22[i].ToString(), Color.Lerp(Color.Yellow, Color.Gold, f22), .1f, 1, 1, .5f));
                        Add(new Numbers(200 + y22, 260, author22[i].ToString(), Color.Lerp(Color.Yellow, Color.Gold, f22), .1f, 1, 1, .3f));
                        Add(new Numbers(200 + y22, 260, author22[i].ToString(), Color.Lerp(Color.Yellow, Color.Gold, f22), .1f, 1, 1, .1f));
                        y22 += 10;
                        f22 += .05f;
                    }
                    string author3 = "You can change any controls by pressing";
                    var f3 = .1f;
                    var y3 = 0;
                    for (var i = 0; i < author3.Length; i++)
                    {
                        Add(new Numbers(200 + y3, 300, author3[i].ToString(), Color.Lerp(Color.Blue, Color.Cyan, f3), .1f));
                        Add(new Numbers(200 + y3, 300, author3[i].ToString(), Color.Lerp(Color.Blue, Color.Cyan, f3), .1f, 1, 1, .5f));
                        Add(new Numbers(200 + y3, 300, author3[i].ToString(), Color.Lerp(Color.Blue, Color.Cyan, f3), .1f, 1, 1, .3f));
                        Add(new Numbers(200 + y3, 300, author3[i].ToString(), Color.Lerp(Color.Blue, Color.Cyan, f3), .1f, 1, 1, .1f));
                        y3 += 10;
                        f3 += .05f;
                    }
                    string author33 = "ESC and going to controls.";
                    var f33 = .1f;
                    var y33 = 0;
                    for (var i = 0; i < author33.Length; i++)
                    {
                        Add(new Numbers(200 + y33, 350, author33[i].ToString(), Color.Lerp(Color.Red, Color.Cyan, f33), .1f));
                        Add(new Numbers(200 + y33, 350, author33[i].ToString(), Color.Lerp(Color.Red, Color.Cyan, f33), .1f, 1, 1, .5f));
                        Add(new Numbers(200 + y33, 350, author33[i].ToString(), Color.Lerp(Color.Red, Color.Cyan, f33), .1f, 1, 1, .3f));
                        Add(new Numbers(200 + y33, 350, author33[i].ToString(), Color.Lerp(Color.Red, Color.Cyan, f33), .1f, 1, 1, .1f));
                        y33 += 10;
                        f33 += .05f;
                    }
                    var pressStart = "Press Start or Enter to Progress to Page 2!";
                    var a = 0;
                    for (var b = 0; b < pressStart.Length; b++)
                    {
                        Add(new Numbers(200 + a, 420, pressStart[b].ToString(), Color.White));
                        Add(new Numbers(200 + a, 420, pressStart[b].ToString(), Color.White, .1f, 1, 1, .5f));
                        Add(new Numbers(200 + a, 420, pressStart[b].ToString(), Color.White, .1f, 1, 1, .3f));
                        Add(new Numbers(200 + a, 420, pressStart[b].ToString(), Color.White, .1f, 1, 1, .1f));
                        a += 10;
                    }
                }

                if (Global.PlayerSession.Controller.Button("P1Start").Pressed)
                {
                    Global.GAME.RemoveScene();
                    SoundManager.PlayRequestedSound("_bossBoom2", 2f);
                    Global.GAME.AddScene(new Tutorial2());// Add next level here or, where you want to go
                }
            }
        }
    }
}
