mirror of https://github.com/ppy/osu
Merge pull request #15173 from peppy/fix-epilepsy-warning-fade-out
Fix epilepsy warning not being faded out on an early exit during gameplay load
This commit is contained in:
commit
f2f9872718
|
@ -291,7 +291,7 @@ public void TestEpilepsyWarning(bool warning)
|
|||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<EpilepsyWarning>().Any() == warning);
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning);
|
||||
|
||||
if (warning)
|
||||
{
|
||||
|
@ -335,12 +335,17 @@ public void TestEpilepsyWarningEarlyExit()
|
|||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("wait for epilepsy warning", () => loader.ChildrenOfType<EpilepsyWarning>().Single().Alpha > 0);
|
||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("exit early", () => loader.Exit());
|
||||
|
||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
}
|
||||
|
||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
||||
|
||||
private class TestPlayerLoader : PlayerLoader
|
||||
{
|
||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||
|
|
|
@ -246,6 +246,9 @@ public override bool OnExiting(IScreen next)
|
|||
cancelLoad();
|
||||
contentOut();
|
||||
|
||||
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
|
||||
epilepsyWarning?.Hide();
|
||||
|
||||
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||
this.Delay(content_out_duration).FadeOut();
|
||||
|
||||
|
|
Loading…
Reference in New Issue