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/KeyCounterKeyboardTrigger.cs
tsrk 076eb81b21
refactor: rename trigger classes
Makes it better to understand their purpose
2023-02-15 21:46:13 +00:00

40 lines
875 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 osu.Framework.Input.Events;
using osuTK.Input;
namespace osu.Game.Screens.Play
{
public partial class KeyCounterKeyboardTrigger : KeyCounter.InputTrigger
{
public Key Key { get; }
public KeyCounterKeyboardTrigger(Key key)
: base(key.ToString())
{
Key = key;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key)
{
Light();
}
return base.OnKeyDown(e);
}
protected override void OnKeyUp(KeyUpEvent e)
{
if (e.Key == Key)
Unlight();
base.OnKeyUp(e);
}
}
}