mirror of
https://github.com/ppy/osu.git
synced 2024-11-08 09:27:32 +08:00
c61fac578c
As for the second suggestion in https://github.com/ppy/osu/pull/22654#discussion_r1109047998, I went with the first one as only one Trigger actually uses this argument for rewinding.
40 lines
881 B
C#
40 lines
881 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)
|
|
{
|
|
Activate();
|
|
}
|
|
|
|
return base.OnKeyDown(e);
|
|
}
|
|
|
|
protected override void OnKeyUp(KeyUpEvent e)
|
|
{
|
|
if (e.Key == Key)
|
|
Deactivate();
|
|
|
|
base.OnKeyUp(e);
|
|
}
|
|
}
|
|
}
|