diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 4a561e6036..e53a1dcd99 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -6,14 +6,22 @@ using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Input; +using osu.Framework.Configuration; +using osu.Framework.Allocation; +using osu.Game.Configuration; namespace osu.Game.Screens.Play { public class KeyCounterCollection : FillFlowContainer { + private const int duration = 100; + + private Bindable showKeyCounter; + public KeyCounterCollection() { AlwaysReceiveInput = true; + AlwaysPresent = true; Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; @@ -34,6 +42,14 @@ public void ResetCount() counter.ResetCount(); } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); + showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration); + showKeyCounter.TriggerChange(); + } + //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor private bool isCounting; public bool IsCounting