Hud Visibility

This commit is contained in:
Andrey Zavadskiy
2017-03-31 16:43:31 +03:00
parent ba7f1233b3
commit d7c39a00b4
4 changed files with 58 additions and 5 deletions

View File

@ -22,6 +22,9 @@ namespace osu.Game.Modes.UI
public readonly HealthDisplay HealthDisplay;
private Bindable<bool> showKeyCounter;
private Bindable<bool> showHud;
public bool IsVisible => showHud;
protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter();
@ -47,11 +50,15 @@ namespace osu.Game.Modes.UI
private void load(OsuConfigManager config)
{
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
showKeyCounter.ValueChanged += visibilityChanged;
showKeyCounter.ValueChanged += keyCounterVisibilityChanged;
showKeyCounter.TriggerChange();
showHud = config.GetBindable<bool>(OsuConfig.ShowInterface);
showHud.ValueChanged += hudVisibilityChanged;
showHud.TriggerChange();
}
private void visibilityChanged(object sender, EventArgs e)
private void keyCounterVisibilityChanged(object sender, EventArgs e)
{
if (showKeyCounter)
KeyCounter.Show();
@ -59,6 +66,19 @@ namespace osu.Game.Modes.UI
KeyCounter.Hide();
}
private void hudVisibilityChanged(object sender, EventArgs e)
{
if (showHud)
Show();
else
Hide();
}
public void ChangeVisibility()
{
showHud.Value = !showHud.Value;
}
public void BindProcessor(ScoreProcessor processor)
{
//bind processor bindables to combocounter, score display etc.