mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 02:22:57 +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 osu.Framework.Graphics.Containers;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
||||||
{
|
{
|
||||||
|
private const int duration = 100;
|
||||||
|
|
||||||
|
private Bindable<bool> showKeyCounter;
|
||||||
|
|
||||||
public KeyCounterCollection()
|
public KeyCounterCollection()
|
||||||
{
|
{
|
||||||
AlwaysReceiveInput = true;
|
AlwaysReceiveInput = true;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
|
||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -34,6 +42,14 @@ namespace osu.Game.Screens.Play
|
|||||||
counter.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
|
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
||||||
private bool isCounting;
|
private bool isCounting;
|
||||||
public bool IsCounting
|
public bool IsCounting
|
||||||
|
Loading…
Reference in New Issue
Block a user