1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Fix background screens not supporting early-exit condition

Closes #2681.
This commit is contained in:
Dean Herbert 2018-06-20 12:43:48 +09:00
parent a01a0b7d52
commit b95042e370
3 changed files with 14 additions and 8 deletions

View File

@ -37,10 +37,17 @@ namespace osu.Game.Screens
}
// Make sure the in-progress loading is complete before pushing the screen.
while (screen.LoadState < LoadState.Ready)
while (screen.LoadState != LoadState.Ready)
Thread.Sleep(1);
base.Push(screen);
try
{
base.Push(screen);
}
catch (InvalidOperationException)
{
// screen may have exited before the push was successful.
}
}
protected override void Update()

View File

@ -195,11 +195,10 @@ namespace osu.Game.Screens
if (Background != null && !Background.Equals(nextOsu?.Background))
{
if (nextOsu != null)
//We need to use MakeCurrent in case we are jumping up multiple game screens.
nextOsu.Background?.MakeCurrent();
else
Background.Exit();
Background.Exit();
//We need to use MakeCurrent in case we are jumping up multiple game screens.
nextOsu?.Background?.MakeCurrent();
}
if (base.OnExiting(next))

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.619.0" />
<PackageReference Include="ppy.osu.Framework" Version="0.0.6042" />
<PackageReference Include="SharpCompress" Version="0.18.1" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />