1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:07:33 +08:00

Merge pull request #1920 from peppy/input-queue-code-quality

Simplify some mouse/keyboard handling overrides
This commit is contained in:
Dan Balasescu 2018-01-16 20:52:45 +09:00 committed by GitHub
commit 0ee9bcd70c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 22 deletions

View File

@ -42,9 +42,9 @@ namespace osu.Game.Graphics.UserInterface
//don't allow clicking between transitions and don't make the chevron clickable
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos);
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => State == Visibility.Visible;
public override bool HandleKeyboardInput => State == Visibility.Visible;
public override bool HandleMouseInput => State == Visibility.Visible;
private Visibility state;

View File

@ -489,9 +489,8 @@ namespace osu.Game.Overlays.Profile
{
private readonly OsuHoverContainer content;
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => content.Action != null;
public override bool HandleKeyboardInput => content.Action != null;
public override bool HandleMouseInput => content.Action != null;
protected override Container<Drawable> Content => content ?? (Container<Drawable>)this;

View File

@ -87,9 +87,8 @@ namespace osu.Game.Overlays.Toolbar
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
}
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => !ruleset.Disabled;
public override bool HandleKeyboardInput => !ruleset.Disabled;
public override bool HandleMouseInput => !ruleset.Disabled;
private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);

View File

@ -222,9 +222,8 @@ namespace osu.Game.Screens.Menu
boxHoverLayer.FadeOut(800, Easing.OutExpo);
}
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
public override bool HandleKeyboardInput => state != ButtonState.Exploded;
public override bool HandleMouseInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
protected override void Update()
{

View File

@ -199,9 +199,8 @@ namespace osu.Game.Screens.Menu
private MenuState state;
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput=> state != MenuState.Exit;
public override bool HandleKeyboardInput => state != MenuState.Exit;
public override bool HandleMouseInput => state != MenuState.Exit;
public MenuState State
{

View File

@ -142,10 +142,6 @@ namespace osu.Game.Screens.Play
}
}
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => State == Visibility.Visible;
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In);
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In);

View File

@ -111,9 +111,8 @@ namespace osu.Game.Screens.Play
}
}
public override bool HandleKeyboardInput => handleInput;
public override bool HandleMouseInput => handleInput;
private bool handleInput => receptor == null;
public override bool HandleKeyboardInput => receptor == null;
public override bool HandleMouseInput => receptor == null;
private Receptor receptor;