mirror of
https://github.com/ppy/osu.git
synced 2025-01-23 18:22:56 +08:00
Fix occasional flash when quick exiting / retrying from player
The gist of the issue is that `fadeOut` was being called *twice* in the quick exit/retry scenarios, causing weirdness with transforms. I've restructured things to ensure it's only called once.
This commit is contained in:
parent
7ee9802923
commit
afeb138ea0
@ -86,6 +86,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public Action<bool> RestartRequested;
|
public Action<bool> RestartRequested;
|
||||||
|
|
||||||
private bool isRestarting;
|
private bool isRestarting;
|
||||||
|
private bool noExitTransition;
|
||||||
|
|
||||||
private Bindable<bool> mouseWheelDisabled;
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
|
|
||||||
@ -297,10 +298,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
if (PerformExit(false))
|
PerformExit(false, true);
|
||||||
// The hotkey overlay dims the screen.
|
|
||||||
// If the operation succeeds, we want to make sure we stay dimmed to keep continuity.
|
|
||||||
fadeOut(true);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -318,10 +316,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
if (Restart(true))
|
Restart(true);
|
||||||
// The hotkey overlay dims the screen.
|
|
||||||
// If the operation succeeds, we want to make sure we stay dimmed to keep continuity.
|
|
||||||
fadeOut(true);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -600,8 +595,9 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Whether the pause or fail dialog should be shown before performing an exit.
|
/// Whether the pause or fail dialog should be shown before performing an exit.
|
||||||
/// If <see langword="true"/> and a dialog is not yet displayed, the exit will be blocked and the relevant dialog will display instead.
|
/// If <see langword="true"/> and a dialog is not yet displayed, the exit will be blocked and the relevant dialog will display instead.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <param name="withoutTransition">Whether the exit should perform without a transition, because the screen had faded to black already.</param>
|
||||||
/// <returns>Whether this call resulted in a final exit.</returns>
|
/// <returns>Whether this call resulted in a final exit.</returns>
|
||||||
protected bool PerformExit(bool showDialogFirst)
|
protected bool PerformExit(bool showDialogFirst, bool withoutTransition = false)
|
||||||
{
|
{
|
||||||
bool pauseOrFailDialogVisible =
|
bool pauseOrFailDialogVisible =
|
||||||
PauseOverlay.State.Value == Visibility.Visible || FailOverlay.State.Value == Visibility.Visible;
|
PauseOverlay.State.Value == Visibility.Visible || FailOverlay.State.Value == Visibility.Visible;
|
||||||
@ -639,6 +635,8 @@ namespace osu.Game.Screens.Play
|
|||||||
// Screen may not be current if a restart has been performed.
|
// Screen may not be current if a restart has been performed.
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
{
|
{
|
||||||
|
noExitTransition = withoutTransition;
|
||||||
|
|
||||||
// The actual exit is performed if
|
// The actual exit is performed if
|
||||||
// - the pause / fail dialog was not requested
|
// - the pause / fail dialog was not requested
|
||||||
// - the pause / fail dialog was requested but is already displayed (user showing intention to exit).
|
// - the pause / fail dialog was requested but is already displayed (user showing intention to exit).
|
||||||
@ -709,7 +707,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
RestartRequested?.Invoke(quickRestart);
|
RestartRequested?.Invoke(quickRestart);
|
||||||
|
|
||||||
return PerformExit(false);
|
return PerformExit(false, quickRestart);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1254,10 +1252,10 @@ namespace osu.Game.Screens.Play
|
|||||||
ShowUserStatistics = true,
|
ShowUserStatistics = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
private void fadeOut(bool instant = false)
|
private void fadeOut()
|
||||||
{
|
{
|
||||||
float fadeOutDuration = instant ? 0 : 250;
|
if (!noExitTransition)
|
||||||
this.FadeOut(fadeOutDuration);
|
this.FadeOut(250);
|
||||||
|
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user