1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 08:37:40 +08:00
osu-lazer/osu.Game/Screens/Play/KeyCounterActionTrigger.cs
tsrk 076eb81b21
refactor: rename trigger classes
Makes it better to understand their purpose
2023-02-15 21:46:13 +00:00

39 lines
973 B
C#

// 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.
#nullable disable
using System.Collections.Generic;
namespace osu.Game.Screens.Play
{
public partial class KeyCounterActionTrigger<T> : KeyCounter.InputTrigger
where T : struct
{
public T Action { get; }
public KeyCounterActionTrigger(T action)
: base($"B{(int)(object)action + 1}")
{
Action = action;
}
public bool OnPressed(T action, bool forwards)
{
if (!EqualityComparer<T>.Default.Equals(action, Action))
return false;
Light(forwards);
return false;
}
public void OnReleased(T action, bool forwards)
{
if (!EqualityComparer<T>.Default.Equals(action, Action))
return;
Unlight(forwards);
}
}
}