Ejemplo n.º 1
0
        /// <summary>
        ///     Updates the screen manager
        /// </summary>
        /// <param name="gameTime"></param>
        public static void Update(GameTime gameTime)
        {
            var game = GameBase.Game as QuaverGame;

            if (QueuedScreen == game?.CurrentScreen || QueuedScreen == null)
            {
                return;
            }

            // Handle delayed screen changes.
            if (DelayedScreenChangeTime != 0)
            {
                TimeElapsedSinceDelayStarted += GameBase.Game.TimeSinceLastFrame;

                if (!(TimeElapsedSinceDelayStarted >= DelayedScreenChangeTime))
                {
                    return;
                }

                Transitioner.FadeIn();
                TimeElapsedSinceDelayStarted = 0;
                DelayedScreenChangeTime      = 0;

                return;
            }

            // Wait for fades to complete first.
            if (Transitioner.Blackness.Animations.Count != 0)
            {
                return;
            }

            var oldScreen = game.CurrentScreen;

            switch (ChangeType)
            {
            case QuaverScreenChangeType.CompleteChange:
                ChangeScreen(QueuedScreen);
                break;

            case QuaverScreenChangeType.AddToStack:
                AddScreen(QueuedScreen);
                break;

            case QuaverScreenChangeType.RemoveTopScreen:
                RemoveTopScreen();

                Button.IsGloballyClickable = true;
                var screen = (QuaverScreen)ScreenManager.Screens.Peek();
                screen.Exiting = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Transitioner.FadeOut();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Called every frame. Waits for a skin reload to be queued up.
        /// </summary>
        public static void HandleSkinReloading()
        {
            // Reload skin when applicable
            if (TimeSkinReloadRequested != 0 && GameBase.Game.TimeRunning - TimeSkinReloadRequested >= 400)
            {
                Load();
                TimeSkinReloadRequested = 0;

                ThreadScheduler.RunAfter(() =>
                {
                    Transitioner.FadeOut();
                    NotificationManager.Show(NotificationLevel.Success, "Skin has been successfully loaded!");
                }, 200);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Called every frame. Waits for a skin reload to be queued up.
        /// </summary>
        private void HandleSkinReloading()
        {
            // Reload skin when applicable
            if (TimeSkinReloadRequested != 0 && GameBase.Game.TimeRunning - TimeSkinReloadRequested >= 400)
            {
                SkinManager.Load();
                NewQueuedSkin           = null;
                TimeSkinReloadRequested = 0;
                IsGloballyClickable     = true;

                ThreadScheduler.RunAfter(() =>
                {
                    Transitioner.FadeOut();
                    NotificationManager.Show(NotificationLevel.Success, "Skin has been successfully loaded!");
                }, 200);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Updates the screen manager
        /// </summary>
        /// <param name="gameTime"></param>
        public static void Update(GameTime gameTime)
        {
            var game = GameBase.Game as QuaverGame;

            if (QueuedScreen == game?.CurrentScreen || QueuedScreen == null)
            {
                return;
            }

            // Handle delayed screen changes.
            if (DelayedScreenChangeTime != 0)
            {
                TimeElapsedSinceDelayStarted += GameBase.Game.TimeSinceLastFrame;

                if (!(TimeElapsedSinceDelayStarted >= DelayedScreenChangeTime))
                {
                    return;
                }

                Transitioner.FadeIn();
                TimeElapsedSinceDelayStarted = 0;
                DelayedScreenChangeTime      = 0;

                return;
            }

            // Wait for fades to complete first.
            if (Transitioner.Blackness.Animations.Count != 0)
            {
                return;
            }

            var oldScreen = game.CurrentScreen;

            ChangeScreen(QueuedScreen);
            oldScreen = null;

            Transitioner.FadeOut();
        }