1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 14:02:54 +08:00
osu-lazer/osu.Game/Screens/Play/KeyCounterKeyboard.cs
2022-11-27 00:00:27 +09:00

39 lines
869 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 KeyCounterKeyboard : KeyCounter
{
public Key Key { get; }
public KeyCounterKeyboard(Key key)
: base(key.ToString())
{
Key = key;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key)
{
IsLit = true;
Increment();
}
return base.OnKeyDown(e);
}
protected override void OnKeyUp(KeyUpEvent e)
{
if (e.Key == Key) IsLit = false;
base.OnKeyUp(e);
}
}
}