mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Merge fa87df6c6a
into aa0ee5cf3a
This commit is contained in:
commit
a33f7bf1d4
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Mods
|
||||
protected override TestPlayer CreateModPlayer(Ruleset ruleset)
|
||||
{
|
||||
var player = base.CreateModPlayer(ruleset);
|
||||
player.RestartRequested = _ => restartRequested = true;
|
||||
player.PrepareLoaderForRestart = _ => restartRequested = true;
|
||||
return player;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
protected virtual bool PauseOnFocusLost => true;
|
||||
|
||||
public Action<bool> RestartRequested;
|
||||
public Action<bool> PrepareLoaderForRestart;
|
||||
|
||||
private bool isRestarting;
|
||||
private bool skipExitTransition;
|
||||
@ -646,7 +646,6 @@ namespace osu.Game.Screens.Play
|
||||
// import current score if possible.
|
||||
prepareAndImportScoreAsync();
|
||||
|
||||
// Screen may not be current if a restart has been performed.
|
||||
if (this.IsCurrentScreen())
|
||||
{
|
||||
skipExitTransition = skipTransition;
|
||||
@ -657,6 +656,12 @@ namespace osu.Game.Screens.Play
|
||||
// - the pause / fail dialog was requested but couldn't be displayed due to the type or state of this Player instance.
|
||||
this.Exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
// May be restarting from results screen.
|
||||
if (this.GetChildScreen() != null)
|
||||
this.MakeCurrent();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -719,12 +724,8 @@ namespace osu.Game.Screens.Play
|
||||
// stopping here is to ensure music doesn't become audible after exiting back to PlayerLoader.
|
||||
musicController.Stop();
|
||||
|
||||
if (RestartRequested != null)
|
||||
{
|
||||
skipExitTransition = quickRestart;
|
||||
RestartRequested?.Invoke(quickRestart);
|
||||
return true;
|
||||
}
|
||||
skipExitTransition = quickRestart;
|
||||
PrepareLoaderForRestart?.Invoke(quickRestart);
|
||||
|
||||
return PerformExit(quickRestart);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ namespace osu.Game.Screens.Play
|
||||
CurrentPlayer = createPlayer();
|
||||
CurrentPlayer.Configuration.AutomaticallySkipIntro |= quickRestart;
|
||||
CurrentPlayer.RestartCount = restartCount++;
|
||||
CurrentPlayer.RestartRequested = restartRequested;
|
||||
CurrentPlayer.PrepareLoaderForRestart = prepareForRestart;
|
||||
|
||||
LoadTask = LoadComponentAsync(CurrentPlayer, _ =>
|
||||
{
|
||||
@ -470,13 +470,11 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
}
|
||||
|
||||
private void restartRequested(bool quickRestartRequested)
|
||||
private void prepareForRestart(bool quickRestartRequested)
|
||||
{
|
||||
quickRestart = quickRestartRequested;
|
||||
hideOverlays = true;
|
||||
ValidForResume = true;
|
||||
|
||||
this.MakeCurrent();
|
||||
}
|
||||
|
||||
private void contentIn(double delayBeforeSideDisplays = 0)
|
||||
|
Loading…
Reference in New Issue
Block a user