1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 21:42:56 +08:00
osu-lazer/osu.Game/Screens/Play/HUD/InputCountController.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.2 KiB
C#
Raw Normal View History

// 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.
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
namespace osu.Game.Screens.Play.HUD
{
2023-06-26 15:47:33 +08:00
/// <summary>
/// Keeps track of key press counts for a current play session, exposing bindable counts which can
/// be used for display purposes.
/// </summary>
public partial class InputCountController : Component
{
public readonly Bindable<bool> IsCounting = new BindableBool(true);
private readonly BindableList<InputTrigger> triggers = new BindableList<InputTrigger>();
public IBindableList<InputTrigger> Triggers => triggers;
public void AddRange(IEnumerable<InputTrigger> triggers) => triggers.ForEach(Add);
public void Add(InputTrigger trigger)
{
// Note that these triggers are not added to the hierarchy here. It is presumed they are added externally at a
// more correct location (ie. inside a RulesetInputManager).
triggers.Add(trigger);
trigger.IsCounting.BindTo(IsCounting);
}
}
}