1
0
mirror of https://github.com/ppy/osu synced 2025-02-04 04:11:54 +00:00
osu/osu.Game/Screens/Play/KeyCounterKeyboardTrigger.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
877 B
C#
Raw Normal View History

// 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 09:19:50 +00:00
2022-06-17 07:37:17 +00:00
#nullable disable
2018-10-02 03:02:47 +00:00
using osu.Framework.Input.Events;
2018-11-20 07:51:59 +00:00
using osuTK.Input;
2018-04-13 09:19:50 +00:00
2017-01-27 12:57:22 +00:00
namespace osu.Game.Screens.Play
{
public partial class KeyCounterKeyboardTrigger : KeyCounter.InputTrigger
{
public Key Key { get; }
2019-02-28 04:31:40 +00:00
public KeyCounterKeyboardTrigger(Key key)
2019-02-28 04:31:40 +00:00
: base(key.ToString())
{
Key = key;
}
2018-04-13 09:19:50 +00:00
2018-10-02 03:02:47 +00:00
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key)
{
LightUp();
}
2018-10-02 03:02:47 +00:00
return base.OnKeyDown(e);
}
2018-04-13 09:19:50 +00:00
protected override void OnKeyUp(KeyUpEvent e)
{
if (e.Key == Key)
Unlight();
base.OnKeyUp(e);
}
}
}