1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Improve skip button behaviour when mouse buttons are down

This commit is contained in:
Dean Herbert 2018-03-06 00:53:40 +09:00
parent d115c56742
commit 4aafc2228e

View File

@ -52,12 +52,6 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre; Origin = Anchor.Centre;
} }
protected override bool OnMouseMove(InputState state)
{
fadeContainer.State = Visibility.Visible;
return base.OnMouseMove(state);
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
@ -122,15 +116,9 @@ namespace osu.Game.Screens.Play
Expire(); Expire();
} }
protected override void PopIn() protected override void PopIn() => this.FadeIn();
{
this.FadeIn();
}
protected override void PopOut() protected override void PopOut() => this.FadeOut();
{
this.FadeOut();
}
protected override void Update() protected override void Update()
{ {
@ -138,6 +126,13 @@ namespace osu.Game.Screens.Play
remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint); remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint);
} }
protected override bool OnMouseMove(InputState state)
{
if (!state.Mouse.HasAnyButtonPressed)
fadeContainer.State = Visibility.Visible;
return base.OnMouseMove(state);
}
public bool OnPressed(GlobalAction action) public bool OnPressed(GlobalAction action)
{ {
switch (action) switch (action)
@ -177,7 +172,7 @@ namespace osu.Game.Screens.Play
if (stateChanged) if (stateChanged)
this.FadeIn(500, Easing.OutExpo); this.FadeIn(500, Easing.OutExpo);
if (!IsHovered) if (!IsHovered && !IsDragged)
using (BeginDelayedSequence(1000)) using (BeginDelayedSequence(1000))
scheduledHide = Schedule(() => State = Visibility.Hidden); scheduledHide = Schedule(() => State = Visibility.Hidden);
break; break;
@ -195,6 +190,18 @@ namespace osu.Game.Screens.Play
base.LoadComplete(); base.LoadComplete();
State = Visibility.Visible; State = Visibility.Visible;
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
scheduledHide?.Cancel();
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
State = Visibility.Visible;
return base.OnMouseUp(state, args);
}
} }
private class Button : OsuClickableContainer private class Button : OsuClickableContainer