Make Footer handles hotkey.

This commit is contained in:
Huo Yaoyuan
2017-03-14 16:58:34 +08:00
parent c3a0549cdd
commit 9a4247f67e
3 changed files with 37 additions and 30 deletions

View File

@ -1,14 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using System;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Select
@ -34,7 +35,7 @@ namespace osu.Game.Screens.Select
set
{
deselectedColour = value;
if(light.Colour != SelectedColour)
if (light.Colour != SelectedColour)
light.Colour = value;
}
}
@ -83,6 +84,7 @@ namespace osu.Game.Screens.Select
public Action Hovered;
public Action HoverLost;
public Key? Hotkey;
protected override bool OnHover(InputState state)
{
@ -119,5 +121,15 @@ namespace osu.Game.Screens.Select
return base.OnClick(state);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (!args.Repeat && args.Key == Hotkey)
{
OnClick(state);
return true;
}
return base.OnKeyDown(state, args);
}
}
}