using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Snake
{
    class LevelCompleteScreen : MenuScreen
    {
        int num;
        int score;
        int lives;

        MenuEntry next = new MenuEntry("Следующий");

        public LevelCompleteScreen(int num, int score, int lives)
            : base("Уровень пройден")
        {
            this.num = num;
            this.score = score;
            this.lives = lives;
            next.Selected += NextMenuEntrySelected;
            MenuEntries.Add(next);
            if (num + 1 == Game1.LEVELS)
                next.Text = "В меню";
        }

        void NextMenuEntrySelected(object sender, PlayerIndexEventArgs arg)
        {
            NextLevel(arg.PlayerIndex);
        }

        public override void LoadContent()
        {
            ScreenManager.PlaySound("complete");
            base.LoadContent();
        }

        void NextLevel(PlayerIndex index)
        {
            if (num + 1 < Game1.LEVELS)
                LoadingScreen.Load(ScreenManager, true, index, new GameplayScreen(num + 1, score, lives));
            else
                LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
        }

        protected override void OnCancel(PlayerIndex index)
        {            
        }
    }
}
