// 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.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; namespace osu.Game.Screens.Play.HUD { /// /// Keeps track of key press counts for a current play session, exposing bindable counts which can /// be used for display purposes. /// public partial class InputCountController : Component { public readonly Bindable IsCounting = new BindableBool(true); private readonly BindableList triggers = new BindableList(); public IBindableList Triggers => triggers; public void AddRange(IEnumerable 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); } } }