1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

revert: make counters an IEnumerable again

As suggested by bdach as this would make the last two commits useless

Refs: 5d15426
This commit is contained in:
tsrk 2023-03-08 21:10:34 +00:00
parent 5d15426c27
commit d806b85a30
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
4 changed files with 8 additions and 10 deletions

View File

@ -8,7 +8,6 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -45,7 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay
// best way to check without exposing. // best way to check without exposing.
private Drawable hideTarget => hudOverlay.KeyCounter; private Drawable hideTarget => hudOverlay.KeyCounter;
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First(); private Drawable keyCounterFlow => (Drawable)hudOverlay.KeyCounter.Counters;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -10,8 +10,6 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -44,7 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay
// best way to check without exposing. // best way to check without exposing.
private Drawable hideTarget => hudOverlay.KeyCounter; private Drawable hideTarget => hudOverlay.KeyCounter;
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First(); private Drawable keyCounterFlow => (Drawable)hudOverlay.KeyCounter.Counters;
[Test] [Test]
public void TestComboCounterIncrementing() public void TestComboCounterIncrementing()

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osuTK.Graphics; using osuTK.Graphics;
@ -12,9 +13,9 @@ namespace osu.Game.Screens.Play.HUD
private const int duration = 100; private const int duration = 100;
private const double key_fade_time = 80; private const double key_fade_time = 80;
private readonly FillFlowContainer<KeyCounter> keyFlow = new FillFlowContainer<KeyCounter>(); private readonly FillFlowContainer<DefaultKeyCounter> keyFlow = new FillFlowContainer<DefaultKeyCounter>();
public override Container<KeyCounter> Counters => keyFlow; public override IEnumerable<KeyCounter> Counters => keyFlow;
public DefaultKeyCounterDisplay() public DefaultKeyCounterDisplay()
{ {
@ -58,7 +59,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
keyDownTextColor = value; keyDownTextColor = value;
foreach (var child in keyFlow) foreach (var child in keyFlow)
((DefaultKeyCounter)child).KeyDownTextColor = value; child.KeyDownTextColor = value;
} }
} }
} }
@ -74,7 +75,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
keyUpTextColor = value; keyUpTextColor = value;
foreach (var child in keyFlow) foreach (var child in keyFlow)
((DefaultKeyCounter)child).KeyUpTextColor = value; child.KeyUpTextColor = value;
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HUD
/// <summary> /// <summary>
/// The <see cref="KeyCounter"/>s contained in this <see cref="KeyCounterDisplay"/>. /// The <see cref="KeyCounter"/>s contained in this <see cref="KeyCounterDisplay"/>.
/// </summary> /// </summary>
public abstract Container<KeyCounter> Counters { get; } public abstract IEnumerable<KeyCounter> Counters { get; }
/// <summary> /// <summary>
/// Whether the actions reported by all <see cref="InputTrigger"/>s within this <see cref="KeyCounterDisplay"/> should be counted. /// Whether the actions reported by all <see cref="InputTrigger"/>s within this <see cref="KeyCounterDisplay"/> should be counted.