diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneJudgementCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneJudgementCounter.cs index f387f1e055..0a501c55c7 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneJudgementCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneJudgementCounter.cs @@ -103,10 +103,10 @@ namespace osu.Game.Tests.Visual.Gameplay { AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = false); AddWaitStep("wait some", 2); - AddAssert("Assert hidden", () => counterDisplay.JudgementContainer.Children.OfType().First().ResultName.Alpha == 0); + AddAssert("Assert hidden", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 0); AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = true); AddWaitStep("wait some", 2); - AddAssert("Assert shown", () => counterDisplay.JudgementContainer.Children.OfType().First().ResultName.Alpha == 1); + AddAssert("Assert shown", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 1); } [Test] @@ -132,13 +132,13 @@ namespace osu.Game.Tests.Visual.Gameplay private int hiddenCount() { - var num = counterDisplay.JudgementContainer.Children.OfType().First(child => child.Result.Type == HitResult.LargeTickHit); + var num = counterDisplay.JudgementContainer.Children.First(child => child.Result.Type == HitResult.LargeTickHit); return num.Result.ResultCount.Value; } private partial class TestJudgementCounterDisplay : JudgementCounterDisplay { - public new FillFlowContainer JudgementContainer => base.JudgementContainer; + public new FillFlowContainer JudgementContainer => base.JudgementContainer; } } } diff --git a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs index f4a732e68e..d3efbc9871 100644 --- a/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/JudgementCounter/JudgementCounterDisplay.cs @@ -34,13 +34,13 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter [Resolved] private JudgementTally tally { get; set; } = null!; - protected FillFlowContainer JudgementContainer = null!; + protected FillFlowContainer JudgementContainer = null!; [BackgroundDependencyLoader] private void load() { AutoSizeAxes = Axes.Both; - InternalChild = JudgementContainer = new FillFlowContainer + InternalChild = JudgementContainer = new FillFlowContainer { Direction = getFillDirection(FlowDirection.Value), Spacing = new Vector2(10), @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter JudgementContainer.Direction = getFillDirection(direction.NewValue); //Can't pass directly due to Enum conversion - foreach (var counter in JudgementContainer.Children.OfType()) + foreach (var counter in JudgementContainer.Children) counter.Direction.Value = getFillDirection(direction.NewValue); }, true); Mode.BindValueChanged(_ => updateMode(), true); @@ -73,7 +73,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter private void updateMode() { - foreach (var counter in JudgementContainer.Children.OfType().Where(counter => !counter.Result.Type.IsBasic())) + foreach (var counter in JudgementContainer.Children.Where(counter => !counter.Result.Type.IsBasic())) { switch (Mode.Value) { @@ -110,15 +110,12 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter } } - private JudgementCounter createCounter(JudgementTally.JudgementCount info) - { - JudgementCounter counter = new JudgementCounter(info) + private JudgementCounter createCounter(JudgementTally.JudgementCount info) => + new JudgementCounter(info) { State = { Value = Visibility.Visible }, ShowName = { BindTarget = ShowJudgementNames } }; - return counter; - } public enum DisplayMode {