diff --git a/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs b/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs index 61efc61537..be8e50d649 100644 --- a/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs +++ b/osu.Game.Tests/Visual/Components/TestSceneIdleTracker.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Components private IdleTrackingBox[] boxes; - public SessionStatics sessionStatics; + private SessionStatics sessionStatics; [SetUp] public void SetUp() => Schedule(() => @@ -175,6 +175,7 @@ namespace osu.Game.Tests.Visual.Components public IdleTrackingBox(int timeToIdle, SessionStatics statics) { + Box box; Alpha = 0.6f; @@ -182,7 +183,7 @@ namespace osu.Game.Tests.Visual.Components InternalChildren = new Drawable[] { - idleTracker = new GameIdleTracker(timeToIdle, statics), + idleTracker = new GameIdleTracker(timeToIdle), box = new Box { Colour = Color4.White, @@ -190,7 +191,11 @@ namespace osu.Game.Tests.Visual.Components }, }; - idleTracker.IsIdle.BindValueChanged(idle => box.Colour = idle.NewValue ? Color4.White : Color4.Black, true); + idleTracker.IsIdle.BindValueChanged(idle => + { + box.Colour = idle.NewValue ? Color4.White : Color4.Black; + if (idle.NewValue) statics.ResetValues(); + }, true); } } } diff --git a/osu.Game/Configuration/SessionStatics.cs b/osu.Game/Configuration/SessionStatics.cs index c960409de8..99089dd076 100644 --- a/osu.Game/Configuration/SessionStatics.cs +++ b/osu.Game/Configuration/SessionStatics.cs @@ -23,10 +23,8 @@ namespace osu.Game.Configuration public void ResetValues() { - SetValue(Static.LoginOverlayDisplayed, false); - SetValue(Static.MutedAudioNotificationShownOnce, false); - SetValue(Static.LowBatteryNotificationShownOnce, false); - SetValue(Static.LastHoverSoundPlaybackTime, (double?)null); + ConfigStore.Clear(); + InitialiseDefaults(); } } diff --git a/osu.Game/Input/GameIdleTracker.cs b/osu.Game/Input/GameIdleTracker.cs index 53dab0c07b..260be7e5c9 100644 --- a/osu.Game/Input/GameIdleTracker.cs +++ b/osu.Game/Input/GameIdleTracker.cs @@ -1,9 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Bindables; using osu.Framework.Input; -using osu.Game.Configuration; namespace osu.Game.Input { @@ -11,16 +9,9 @@ namespace osu.Game.Input { private InputManager inputManager; - public GameIdleTracker(int time, SessionStatics statics) + public GameIdleTracker(int time) : base(time) { - IsIdle.ValueChanged += _ => UpdateStatics(_, statics); - } - - protected static void UpdateStatics(ValueChangedEvent e, SessionStatics statics) - { - if (e.OldValue != e.NewValue && e.NewValue) - statics.ResetValues(); } protected override void LoadComplete() diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3930db01b9..0abb0373fa 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -575,7 +575,16 @@ namespace osu.Game Container logoContainer; BackButton.Receptor receptor; - dependencies.CacheAs(idleTracker = new GameIdleTracker(300_000, Dependencies.Get())); + dependencies.CacheAs(idleTracker = new GameIdleTracker(6000)); + + GameIdleTracker sessionIdleTracker = new GameIdleTracker(300_000); + Add(sessionIdleTracker); + + sessionIdleTracker.IsIdle.BindValueChanged((e) => + { + if (e.NewValue) + Dependencies.Get().ResetValues(); + }); AddRange(new Drawable[] {