mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:42:54 +08:00
Merge branch 'master' into cursor-trail
This commit is contained in:
commit
b27b6c7eb7
@ -5,12 +5,14 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
|
|
||||||
@ -21,7 +23,6 @@ namespace osu.Game.Screens.Play
|
|||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
private BeatmapMetadataDisplay info;
|
private BeatmapMetadataDisplay info;
|
||||||
private VisualSettings visualSettings;
|
|
||||||
|
|
||||||
private bool showOverlays = true;
|
private bool showOverlays = true;
|
||||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
public override bool ShowOverlaysOnEnter => showOverlays;
|
||||||
@ -46,7 +47,8 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
});
|
});
|
||||||
Add(visualSettings = new VisualSettings
|
|
||||||
|
Add(new VisualSettings
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -93,7 +95,7 @@ namespace osu.Game.Screens.Play
|
|||||||
contentIn();
|
contentIn();
|
||||||
|
|
||||||
info.Delay(750).FadeIn(500);
|
info.Delay(750).FadeIn(500);
|
||||||
this.Delay(2150).Schedule(pushWhenLoaded);
|
this.Delay(1800).Schedule(pushWhenLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
@ -109,29 +111,65 @@ namespace osu.Game.Screens.Play
|
|||||||
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
|
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool weHandledMouseDown;
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
weHandledMouseDown = true;
|
||||||
|
return base.OnMouseDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
|
{
|
||||||
|
weHandledMouseDown = false;
|
||||||
|
return base.OnMouseUp(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScheduledDelegate pushDebounce;
|
||||||
|
|
||||||
|
private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && (!GetContainingInputManager().CurrentState.Mouse.HasAnyButtonPressed || weHandledMouseDown);
|
||||||
|
|
||||||
private void pushWhenLoaded()
|
private void pushWhenLoaded()
|
||||||
{
|
{
|
||||||
if (player.LoadState != LoadState.Ready || visualSettings.IsHovered)
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!readyForPush)
|
||||||
|
{
|
||||||
|
// as the pushDebounce below has a delay, we need to keep checking and cancel a future debounce
|
||||||
|
// if we become unready for push during the delay.
|
||||||
|
pushDebounce?.Cancel();
|
||||||
|
pushDebounce = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pushDebounce != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pushDebounce = Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
contentOut();
|
||||||
|
|
||||||
|
this.Delay(250).Schedule(() =>
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
if (!Push(player))
|
||||||
|
Exit();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//By default, we want to load the player and never be returned to.
|
||||||
|
//Note that this may change if the player we load requested a re-run.
|
||||||
|
ValidForResume = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
finally
|
||||||
{
|
{
|
||||||
Schedule(pushWhenLoaded);
|
Schedule(pushWhenLoaded);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentOut();
|
|
||||||
|
|
||||||
this.Delay(250).Schedule(() =>
|
|
||||||
{
|
|
||||||
if (!IsCurrentScreen) return;
|
|
||||||
|
|
||||||
if (!Push(player))
|
|
||||||
Exit();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//By default, we want to load the player and never be returned to.
|
|
||||||
//Note that this may change if the player we load requested a re-run.
|
|
||||||
ValidForResume = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -133,5 +134,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state) => true;
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user