1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 03:52:55 +08:00
osu-lazer/osu.Game/Screens/Play/KeyCounterKeyboard.cs

31 lines
877 B
C#
Raw Normal View History

2018-04-13 17:19:50 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-07-21 10:38:28 +08:00
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
2018-04-13 17:19:50 +08:00
using OpenTK.Input;
namespace osu.Game.Screens.Play
{
public class KeyCounterKeyboard : KeyCounter
{
public Key Key { get; }
public KeyCounterKeyboard(Key key) : base(key.ToString())
{
Key = key;
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Key == Key) IsLit = true;
return base.OnKeyDown(state, args);
}
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
{
if (args.Key == Key) IsLit = false;
return base.OnKeyUp(state, args);
}
}
}