Merge pull request #1711 from peppy/fix-gameplay-menu-blocking

Fix keyboard and mouse input not properly getting blocked by GameplayMenuOverlay
This commit is contained in:
Dean Herbert 2017-12-21 20:54:25 +09:00 committed by GitHub
commit 28cc125d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 19 deletions

@ -1 +1 @@
Subproject commit 28fbd0711c09d3b06b51fc728b025f83ded2f0f8
Subproject commit f4fde31f8c09305d2130064da2f7bae995be8286

View File

@ -5,11 +5,12 @@ using System.Collections.Generic;
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 @@ namespace osu.Game.Screens.Play
protected override bool BlockPassThroughKeyboard => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry;
public Action OnQuit;
@ -197,6 +199,7 @@ namespace osu.Game.Screens.Play
}
private int _selectionIndex = -1;
private int selectionIndex
{
get { return _selectionIndex; }
@ -219,26 +222,26 @@ namespace osu.Game.Screens.Play
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)