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

refactor: make Counters return a Container

This commit is contained in:
tsrk 2023-03-08 01:52:12 +00:00
parent 5b0db94a24
commit 5d15426c27
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
2 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
// 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;
@ -13,9 +12,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<DefaultKeyCounter> keyFlow = new FillFlowContainer<DefaultKeyCounter>(); private readonly FillFlowContainer<KeyCounter> keyFlow = new FillFlowContainer<KeyCounter>();
public override IEnumerable<KeyCounter> Counters => keyFlow; public override Container<KeyCounter> Counters => keyFlow;
public DefaultKeyCounterDisplay() public DefaultKeyCounterDisplay()
{ {
@ -59,7 +58,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
keyDownTextColor = value; keyDownTextColor = value;
foreach (var child in keyFlow) foreach (var child in keyFlow)
child.KeyDownTextColor = value; ((DefaultKeyCounter)child).KeyDownTextColor = value;
} }
} }
} }
@ -75,7 +74,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
keyUpTextColor = value; keyUpTextColor = value;
foreach (var child in keyFlow) foreach (var child in keyFlow)
child.KeyUpTextColor = value; ((DefaultKeyCounter)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 IEnumerable<KeyCounter> Counters { get; } public abstract Container<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.