예제 #1
0
파일: PauseScreen.cs 프로젝트: jaydn/Quaver
        /// <inheritdoc />
        /// <summary>
        ///     Ctor
        /// </summary>
        /// <param name="screen"></param>
        public PauseScreen(GameplayScreen screen)
        {
            Screen = screen;

            // Background
            Background = new Sprite()
            {
                Parent = this,
                Size   = new ScalableVector2(WindowManager.Width, WindowManager.Height),
                Alpha  = 0,
                Image  = SkinManager.Skin.PauseBackground,
            };

            // Continue Button
            Continue = new ImageButton(SkinManager.Skin.PauseContinue, (o, e) =>
            {
                if (!Screen.IsPaused)
                {
                    return;
                }

                Screen.Pause();
            })
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                Y         = -150,
                X         = -SkinManager.Skin.PauseContinue.Width,
                Alpha     = 1,
                UsePreviousSpriteBatchOptions = true
            };

            Continue.Size = new ScalableVector2(Continue.Image.Width, Continue.Image.Height);

            // Retry Button
            Retry = new ImageButton(SkinManager.Skin.PauseRetry, (o, e) =>
            {
                if (!Screen.IsPaused)
                {
                    return;
                }

                SkinManager.Skin.SoundRetry.CreateChannel().Play();
                QuaverScreenManager.ChangeScreen(new GameplayScreen(Screen.Map, Screen.MapHash, Screen.LocalScores));
            })
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                Y         = 20,
                X         = -SkinManager.Skin.PauseRetry.Width,
                Alpha     = 1,
                UsePreviousSpriteBatchOptions = true
            };

            Retry.Size = new ScalableVector2(Retry.Image.Width, Retry.Image.Height);

            // Quit Button
            Quit = new ImageButton(SkinManager.Skin.PauseBack, (o, e) =>
            {
                if (!Screen.IsPaused)
                {
                    return;
                }

                Screen.IsPaused  = false;
                Screen.ForceFail = true;
                Screen.HasQuit   = true;

                // Make sure the screen transitioner isn't faded out at all
                var screenView = (GameplayScreenView)Screen.View;
                screenView.Transitioner.Alpha = 0;
            })
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                Y         = 190,
                X         = -SkinManager.Skin.PauseBack.Width,
                Alpha     = 1,
                UsePreviousSpriteBatchOptions = true
            };

            Quit.Size = new ScalableVector2(Quit.Image.Width, Quit.Image.Height);
        }