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,14 +41,19 @@ namespace osu.Game.Modes.UI
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AlwaysPresent = true; AlwaysPresent = true;
Children = new Drawable[] Add(hud = new Container
{ {
KeyCounter = CreateKeyCounter(), RelativeSizeAxes = Axes.Both,
ComboCounter = CreateComboCounter(),
ScoreCounter = CreateScoreCounter(), Children = new Drawable[]
AccuracyCounter = CreateAccuracyCounter(), {
HealthDisplay = CreateHealthDisplay(), KeyCounter = CreateKeyCounter(),
}; ComboCounter = CreateComboCounter(),
ScoreCounter = CreateScoreCounter(),
AccuracyCounter = CreateAccuracyCounter(),
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)