Moved KeyCounter visibility logic to it's own class

This commit is contained in:
EVAST9919 2017-05-23 11:53:42 +03:00
parent eafe215169
commit 4b23cc47ea
1 changed files with 16 additions and 0 deletions

View File

@ -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<KeyCounter>
{
private const int duration = 100;
private Bindable<bool> 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<bool>(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