// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; namespace osu.Game.Screens.Play.HUD { /// /// An event trigger which can be used with to create visual tracking of button/key presses. /// public abstract partial class InputTrigger : Component { /// /// Callback to invoke when the associated input has been activated. /// /// Whether gameplay is progressing in the forward direction time-wise. public delegate void OnActivateCallback(bool forwardPlayback); /// /// Callback to invoke when the associated input has been deactivated. /// /// Whether gameplay is progressing in the forward direction time-wise. public delegate void OnDeactivateCallback(bool forwardPlayback); public event OnActivateCallback? OnActivate; public event OnDeactivateCallback? OnDeactivate; protected InputTrigger(string name) { Name = name; } protected void Activate(bool forwardPlayback = true) => OnActivate?.Invoke(forwardPlayback); protected void Deactivate(bool forwardPlayback = true) => OnDeactivate?.Invoke(forwardPlayback); } }