mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:43:21 +08:00
Moved KeyCounter visibility logic to it's own class
This commit is contained in:
parent
eafe215169
commit
4b23cc47ea
@ -6,14 +6,22 @@ using osu.Framework.Graphics;
|
||||
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 @@ namespace osu.Game.Screens.Play
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user