From d806b85a30ca59d2515b29bc18b7362ae7931902 Mon Sep 17 00:00:00 2001 From: tsrk Date: Wed, 8 Mar 2023 21:10:34 +0000 Subject: [PATCH] revert: make `counters` an `IEnumerable` again As suggested by bdach as this would make the last two commits useless Refs: 5d15426 --- osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs | 3 +-- .../Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs | 4 +--- osu.Game/Screens/Play/HUD/DefaultKeyCounterDisplay.cs | 9 +++++---- osu.Game/Screens/Play/HUD/KeyCounterDisplay.cs | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs index aeb7aa7dbe..42683a3eec 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs @@ -8,7 +8,6 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Configuration; @@ -45,7 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay // best way to check without exposing. private Drawable hideTarget => hudOverlay.KeyCounter; - private FillFlowContainer keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType>().First(); + private Drawable keyCounterFlow => (Drawable)hudOverlay.KeyCounter.Counters; [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs index 808241729b..3eda80719a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs @@ -10,8 +10,6 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -44,7 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay // best way to check without exposing. private Drawable hideTarget => hudOverlay.KeyCounter; - private FillFlowContainer keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType>().First(); + private Drawable keyCounterFlow => (Drawable)hudOverlay.KeyCounter.Counters; [Test] public void TestComboCounterIncrementing() diff --git a/osu.Game/Screens/Play/HUD/DefaultKeyCounterDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultKeyCounterDisplay.cs index dce0be9cde..9499263474 100644 --- a/osu.Game/Screens/Play/HUD/DefaultKeyCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/DefaultKeyCounterDisplay.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK.Graphics; @@ -12,9 +13,9 @@ namespace osu.Game.Screens.Play.HUD private const int duration = 100; private const double key_fade_time = 80; - private readonly FillFlowContainer keyFlow = new FillFlowContainer(); + private readonly FillFlowContainer keyFlow = new FillFlowContainer(); - public override Container Counters => keyFlow; + public override IEnumerable Counters => keyFlow; public DefaultKeyCounterDisplay() { @@ -58,7 +59,7 @@ namespace osu.Game.Screens.Play.HUD { keyDownTextColor = value; foreach (var child in keyFlow) - ((DefaultKeyCounter)child).KeyDownTextColor = value; + child.KeyDownTextColor = value; } } } @@ -74,7 +75,7 @@ namespace osu.Game.Screens.Play.HUD { keyUpTextColor = value; foreach (var child in keyFlow) - ((DefaultKeyCounter)child).KeyUpTextColor = value; + child.KeyUpTextColor = value; } } } diff --git a/osu.Game/Screens/Play/HUD/KeyCounterDisplay.cs b/osu.Game/Screens/Play/HUD/KeyCounterDisplay.cs index 2c90d1474d..0e0f8a1190 100644 --- a/osu.Game/Screens/Play/HUD/KeyCounterDisplay.cs +++ b/osu.Game/Screens/Play/HUD/KeyCounterDisplay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HUD /// /// The s contained in this . /// - public abstract Container Counters { get; } + public abstract IEnumerable Counters { get; } /// /// Whether the actions reported by all s within this should be counted.