2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
|
{
|
|
|
|
|
public class KeyCounterAction<T> : KeyCounter, IKeyBindingHandler<T>
|
|
|
|
|
where T : struct
|
|
|
|
|
{
|
|
|
|
|
public T Action { get; }
|
|
|
|
|
|
2019-02-28 12:31:40 +08:00
|
|
|
|
public KeyCounterAction(T action)
|
|
|
|
|
: base($"B{(int)(object)action + 1}")
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Action = action;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool OnPressed(T action)
|
|
|
|
|
{
|
|
|
|
|
if (action.Equals(Action)) IsLit = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool OnReleased(T action)
|
|
|
|
|
{
|
|
|
|
|
if (action.Equals(Action)) IsLit = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|