Allow skipping storyboard outro

Reuses SkipOverlay by calculating the endtime of the storyboard and using that as a "start point". Upon skipping the outro the score is instantly shown.
When the end of the storyboard is reached the score screen automatically shows up. If the player holds ESC (pause) during the outro, the score is displayed

The storyboard endtime is calculated by getting the latest endtime of the storyboard's elements, or simply returning 0 if there is no storyboard.

Co-Authored-By: Marlina José <marlina@umich.edu>
This commit is contained in:
Christine Chen
2021-04-14 00:04:03 -04:00
parent 16d34bcc0a
commit 25b8c2f257
6 changed files with 166 additions and 0 deletions

View File

@ -74,6 +74,8 @@ namespace osu.Game.Screens.Play
private Bindable<bool> mouseWheelDisabled;
private Bindable<bool> storyboardEnabled;
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
protected readonly Bindable<bool> LocalUserPlaying = new Bindable<bool>();
@ -106,6 +108,8 @@ namespace osu.Game.Screens.Play
private SkipOverlay skipOverlay;
private SkipOverlay skipOutroOverlay;
protected ScoreProcessor ScoreProcessor { get; private set; }
protected HealthProcessor HealthProcessor { get; private set; }
@ -190,6 +194,8 @@ namespace osu.Game.Screens.Play
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
storyboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
if (game != null)
gameActive.BindTo(game.IsActive);
@ -285,6 +291,9 @@ namespace osu.Game.Screens.Play
ScoreProcessor.HasCompleted.ValueChanged += updateCompletionState;
HealthProcessor.Failed += onFail;
// Keep track of whether the storyboard ended after the playable portion
GameplayClockContainer.HasStoryboardEnded.ValueChanged += updateCompletionState;
foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
mod.ApplyToScoreProcessor(ScoreProcessor);
@ -360,6 +369,10 @@ namespace osu.Game.Screens.Play
{
RequestSkip = performUserRequestedSkip
},
skipOutroOverlay = new SkipOverlay(GameplayClockContainer.StoryboardEndTime)
{
RequestSkip = scheduleCompletion
},
FailOverlay = new FailOverlay
{
OnRetry = Restart,
@ -389,6 +402,9 @@ namespace osu.Game.Screens.Play
if (!Configuration.AllowSkippingIntro)
skipOverlay.Expire();
if (!Configuration.AllowSkippingOutro)
skipOutroOverlay.Expire();
if (Configuration.AllowRestart)
{
container.Add(new HotkeyRetryOverlay
@ -403,6 +419,8 @@ namespace osu.Game.Screens.Play
});
}
skipOutroOverlay.Hide();
return container;
}
@ -523,6 +541,14 @@ namespace osu.Game.Screens.Play
Pause();
return;
}
// show the score if in storyboard outro (score has been set)
bool scoreReady = prepareScoreForDisplayTask != null && prepareScoreForDisplayTask.IsCompleted;
if (scoreReady)
{
scheduleCompletion();
}
}
this.Exit();
@ -611,6 +637,14 @@ namespace osu.Game.Screens.Play
return score.ScoreInfo;
});
// show skip overlay if storyboard is enabled and has an outro
if (storyboardEnabled.Value && GameplayClockContainer.HasTimeLeftInStoryboard)
{
skipOutroOverlay.Show();
completionProgressDelegate = null;
return;
}
using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
scheduleCompletion();
}