Exemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        ///     Allows the game to run logic such as updating the world,
        ///     checking for collisions, gathering input, and playing audio.
        /// </summary>
        protected override void Update(GameTime gameTime)
        {
            if (!IsReadyToUpdate)
            {
                return;
            }

            base.Update(gameTime);

            if (SteamManager.IsInitialized)
            {
                SteamAPI.RunCallbacks();
            }

            // Run scheduled background tasks
            CommonTaskScheduler.Run();

            BackgroundManager.Update(gameTime);
            BackgroundHelper.Update(gameTime);
            NotificationManager.Update(gameTime);
            ChatManager.Update(gameTime);
            DialogManager.Update(gameTime);

            HandleGlobalInput(gameTime);

            QuaverScreenManager.Update(gameTime);
            Transitioner.Update(gameTime);

            SkinManager.HandleSkinReloading();
            LimitFpsOnInactiveWindow();
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Config Autosave functionality for Bindable<T>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="d"></param>
 private static void AutoSaveConfiguration <T>(object sender, BindableValueChangedEventArgs <T> d)
 {
     // ReSharper disable once ArrangeMethodOrOperatorBody
     CommonTaskScheduler.Add(CommonTask.WriteConfig);
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        /// <summary>
        ///     Allows the game to run logic such as updating the world,
        ///     checking for collisions, gathering input, and playing audio.
        /// </summary>
        protected override void Update(GameTime gameTime)
        {
            if (!IsReadyToUpdate)
            {
                return;
            }

            base.Update(gameTime);

            if (SteamManager.IsInitialized)
            {
                SteamAPI.RunCallbacks();
            }

            // Run scheduled background tasks
            CommonTaskScheduler.Run();

            BackgroundManager.Update(gameTime);
            BackgroundHelper.Update(gameTime);
            NotificationManager.Update(gameTime);
            ChatManager.Update(gameTime);
            DialogManager.Update(gameTime);

            // Handles FPS limiter changes
            if (KeyboardManager.IsUniqueKeyPress(Keys.F7))
            {
                var index = (int)ConfigManager.FpsLimiterType.Value;

                if (index + 1 < Enum.GetNames(typeof(FpsLimitType)).Length)
                {
                    ConfigManager.FpsLimiterType.Value = (FpsLimitType)index + 1;
                }
                else
                {
                    ConfigManager.FpsLimiterType.Value = FpsLimitType.Unlimited;
                }

                switch (ConfigManager.FpsLimiterType.Value)
                {
                case FpsLimitType.Unlimited:
                    NotificationManager.Show(NotificationLevel.Info, "FPS is now unlimited.");
                    break;

                case FpsLimitType.Limited:
                    NotificationManager.Show(NotificationLevel.Info, $"FPS is now limited to: 240 FPS");
                    break;

                case FpsLimitType.Vsync:
                    NotificationManager.Show(NotificationLevel.Info, $"Vsync Enabled");
                    break;

                case FpsLimitType.Custom:
                    NotificationManager.Show(NotificationLevel.Info, $"FPS is now custom limited to: {ConfigManager.CustomFpsLimit.Value}");
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            QuaverScreenManager.Update(gameTime);
            Transitioner.Update(gameTime);
        }