Added container whose visibility will be changable

This commit is contained in:
Andrey Zavadskiy 2017-04-03 11:41:17 +03:00
parent 8d28c54ff3
commit e51fdd3c86

View File

@ -28,6 +28,8 @@ namespace osu.Game.Modes.UI
private Bindable<bool> showKeyCounter; private Bindable<bool> showKeyCounter;
private Bindable<bool> showHud; private Bindable<bool> showHud;
private readonly Container hud;
protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter(); protected abstract ComboCounter CreateComboCounter();
protected abstract PercentageCounter CreateAccuracyCounter(); protected abstract PercentageCounter CreateAccuracyCounter();
@ -39,6 +41,10 @@ namespace osu.Game.Modes.UI
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AlwaysPresent = true; AlwaysPresent = true;
Add(hud = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
KeyCounter = CreateKeyCounter(), KeyCounter = CreateKeyCounter(),
@ -46,7 +52,8 @@ namespace osu.Game.Modes.UI
ScoreCounter = CreateScoreCounter(), ScoreCounter = CreateScoreCounter(),
AccuracyCounter = CreateAccuracyCounter(), AccuracyCounter = CreateAccuracyCounter(),
HealthDisplay = CreateHealthDisplay(), HealthDisplay = CreateHealthDisplay(),
}; }
});
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
@ -80,9 +87,9 @@ namespace osu.Game.Modes.UI
private void hudVisibilityChanged(object sender, EventArgs e) private void hudVisibilityChanged(object sender, EventArgs e)
{ {
if (showHud) if (showHud)
Show(); hud.Show();
else else
Hide(); hud.Hide();
} }
public void BindProcessor(ScoreProcessor processor) public void BindProcessor(ScoreProcessor processor)