1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00

Tidy up conditionals

This commit is contained in:
Dean Herbert 2017-08-22 18:21:00 +09:00
parent a26885c1ab
commit 97acff535d

View File

@ -136,40 +136,34 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (HasFocus)
{
if (bindTarget.IsHovered)
{
if (!AllowMainMouseButtons)
{
switch (args.Button)
{
case MouseButton.Left:
case MouseButton.Right:
return true;
}
}
if (!HasFocus || !bindTarget.IsHovered)
return base.OnMouseDown(state, args);
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
return true;
if (!AllowMainMouseButtons)
{
switch (args.Button)
{
case MouseButton.Left:
case MouseButton.Right:
return true;
}
}
return base.OnMouseDown(state, args);
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
return true;
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
if (HasFocus && !state.Mouse.Buttons.Any())
{
if (bindTarget.IsHovered)
finalise();
else
updateBindTarget();
return true;
}
// don't do anything until the last button is released.
if (!HasFocus || state.Mouse.Buttons.Any())
return base.OnMouseUp(state, args);
return base.OnMouseUp(state, args);
if (bindTarget.IsHovered)
finalise();
else
updateBindTarget();
return true;
}
protected override bool OnWheel(InputState state)
@ -211,13 +205,10 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
{
if (HasFocus)
{
finalise();
return true;
}
if (!HasFocus) return base.OnKeyUp(state, args);
return base.OnKeyUp(state, args);
finalise();
return true;
}
private void finalise()