From e51fdd3c863098687f546c269734e3e9e3a0f6f8 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 11:41:17 +0300 Subject: [PATCH] Added container whose visibility will be changable --- osu.Game/Modes/UI/HudOverlay.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 4a2f8f0c41..162fe05148 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -28,6 +28,8 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; private Bindable showHud; + private readonly Container hud; + protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); protected abstract PercentageCounter CreateAccuracyCounter(); @@ -39,14 +41,19 @@ namespace osu.Game.Modes.UI RelativeSizeAxes = Axes.Both; AlwaysPresent = true; - Children = new Drawable[] + Add(hud = new Container { - KeyCounter = CreateKeyCounter(), - ComboCounter = CreateComboCounter(), - ScoreCounter = CreateScoreCounter(), - AccuracyCounter = CreateAccuracyCounter(), - HealthDisplay = CreateHealthDisplay(), - }; + RelativeSizeAxes = Axes.Both, + + Children = new Drawable[] + { + KeyCounter = CreateKeyCounter(), + ComboCounter = CreateComboCounter(), + ScoreCounter = CreateScoreCounter(), + AccuracyCounter = CreateAccuracyCounter(), + HealthDisplay = CreateHealthDisplay(), + } + }); } [BackgroundDependencyLoader(true)] @@ -80,9 +87,9 @@ namespace osu.Game.Modes.UI private void hudVisibilityChanged(object sender, EventArgs e) { if (showHud) - Show(); + hud.Show(); else - Hide(); + hud.Hide(); } public void BindProcessor(ScoreProcessor processor)