screen manager now only triggers event when screen is actually required.

This commit is contained in:
2018-11-12 19:43:03 -06:00
parent d8bb78252d
commit fffc883327
2 changed files with 8 additions and 4 deletions

View File

@@ -67,7 +67,10 @@ namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
case ScreenState.ExitTransition:
if (Screen.UseRenderTargetForExitTransition || Screen.UpdateTransition(gameTime.ElapsedGameTime.TotalSeconds, assetsDone))
{
OnRequireNextScreen(Screen);
if (Screen.NextScreen == null)
{
OnRequireNextScreen(Screen);
}
if (Screen.NextScreen != null)
{
Debug.WriteLine("Changing to the next given screen.");
@@ -77,7 +80,8 @@ namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
{
Debug.WriteLine("Changing to previous screen.");
Screen = previousScreen;
} else
}
else
{
throw new InvalidOperationException("No next screen provided and no previous screen to return to.");
}