diff --git a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs index 27dd98289a..82f24c736e 100644 --- a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -66,30 +65,27 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter counter.Direction.Value = convertedDirection; }, true); - Mode.BindValueChanged(_ => - { - updateMode(); - - //Refreshing the counter causes the first child to become visible, so we want to make sure it isn't if it shouldn't be - updateFirstChildVisibility(); - }, true); - - ShowMaxJudgement.BindValueChanged(showMax => - updateFirstChildVisibility(), true); + Mode.BindValueChanged(_ => updateDisplay()); + ShowMaxJudgement.BindValueChanged(_ => updateDisplay(), true); } - private void updateMode() + private void updateDisplay() { - foreach (var counter in CounterFlow.Children) + for (int i = 0; i < CounterFlow.Children.Count; i++) { - if (shouldShow(counter)) + JudgementCounter counter = CounterFlow.Children[i]; + + if (shouldShow(i, counter)) counter.Show(); else counter.Hide(); } - bool shouldShow(JudgementCounter counter) + bool shouldShow(int index, JudgementCounter counter) { + if (index == 0 && !ShowMaxJudgement.Value) + return false; + if (counter.Result.Type.IsBasic()) return true; @@ -110,14 +106,6 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter } } - private void updateFirstChildVisibility() - { - var firstChild = CounterFlow.Children.FirstOrDefault(); - - if (firstChild != null) - firstChild.State.Value = ShowMaxJudgement.Value ? Visibility.Visible : Visibility.Hidden; - } - private FillDirection getFillDirection(Direction flow) { switch (flow)