Fix keyboard and mouse input not properly getting blocked by GameplayMenuOverlay

This commit is contained in:
Dean Herbert 2017-12-21 13:58:24 +09:00
parent 504ba1d6bc
commit b6fd5b0f17
2 changed files with 22 additions and 18 deletions

View File

@ -5,11 +5,12 @@
using System.ComponentModel;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
namespace osu.Game.Input.Bindings
{
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>, IHandleGlobalInput
{
private readonly Drawable handler;

View File

@ -26,6 +26,8 @@ public abstract class GameplayMenuOverlay : OverlayContainer, IRequireHighFreque
protected override bool BlockPassThroughKeyboard => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry;
public Action OnQuit;
@ -197,6 +199,7 @@ protected void AddButton(string text, Color4 colour, Action action)
}
private int _selectionIndex = -1;
private int selectionIndex
{
get { return _selectionIndex; }
@ -219,26 +222,26 @@ private int selectionIndex
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat)
return false;
switch (args.Key)
if (!args.Repeat)
{
case Key.Up:
if (selectionIndex == -1 || selectionIndex == 0)
selectionIndex = InternalButtons.Count - 1;
else
selectionIndex--;
return true;
case Key.Down:
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
selectionIndex = 0;
else
selectionIndex++;
return true;
switch (args.Key)
{
case Key.Up:
if (selectionIndex == -1 || selectionIndex == 0)
selectionIndex = InternalButtons.Count - 1;
else
selectionIndex--;
return true;
case Key.Down:
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
selectionIndex = 0;
else
selectionIndex++;
return true;
}
}
return false;
return base.OnKeyDown(state, args);
}
private void buttonSelectionChanged(DialogButton button, bool isSelected)