1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Improve skip boundary logic to be closer to expectations

Supersedes #4693.
Closes #4676.
This commit is contained in:
Dean Herbert 2019-05-05 20:20:41 +09:00
parent f05471aa18
commit 7fdc79dd68

View File

@ -38,6 +38,10 @@ namespace osu.Game.Screens.Play
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
protected override bool BlockPositionalInput => false;
/// <summary>
/// Displays a skip overlay, giving the user the ability to skip forward.
/// </summary>
/// <param name="startTime">The time at which gameplay begins to appear.</param>
public SkipOverlay(double startTime)
{
this.startTime = startTime;
@ -87,16 +91,21 @@ namespace osu.Game.Screens.Play
};
}
private const double skip_required_cutoff = 3000;
/// <summary>
/// Duration before gameplay start time required before skip button displays.
/// </summary>
private const double skip_buffer = 1000;
private const double fade_time = 300;
private double beginFadeTime => startTime - skip_required_cutoff - fade_time;
private double beginFadeTime => startTime - fade_time;
protected override void LoadComplete()
{
base.LoadComplete();
if (startTime < skip_required_cutoff)
// skip is not required if there is no extra "empty" time to skip.
if (Clock.CurrentTime > beginFadeTime - skip_buffer)
{
Alpha = 0;
Expire();
@ -107,7 +116,7 @@ namespace osu.Game.Screens.Play
using (BeginAbsoluteSequence(beginFadeTime))
this.FadeOut(fade_time);
button.Action = () => RequestSeek?.Invoke(startTime - skip_required_cutoff - fade_time);
button.Action = () => RequestSeek?.Invoke(beginFadeTime);
displayTime = Time.Current;