Move seasonalBackgroundMode check up and early return if available

This commit is contained in:
Max Hübner 2020-10-30 17:16:51 +01:00
parent f6eb5680ec
commit 0b46c19b23

View File

@ -79,6 +79,18 @@ namespace osu.Game.Screens.Backgrounds
Background newBackground;
string backgroundName;
if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Always
|| seasonalBackgroundMode.Value == SeasonalBackgroundMode.Sometimes && seasonalBackgroundLoader.IsInSeason)
{
var seasonalBackground = seasonalBackgroundLoader.LoadBackground();
if (seasonalBackground != null)
{
seasonalBackground.Depth = currentDisplay;
return seasonalBackground;
}
}
switch (introSequence.Value)
{
case IntroSequence.Welcome:
@ -106,12 +118,6 @@ namespace osu.Game.Screens.Backgrounds
else
newBackground = new Background(backgroundName);
if (seasonalBackgroundMode.Value == SeasonalBackgroundMode.Always
|| seasonalBackgroundMode.Value == SeasonalBackgroundMode.Sometimes && seasonalBackgroundLoader.IsInSeason)
{
newBackground = seasonalBackgroundLoader.LoadBackground() ?? newBackground;
}
newBackground.Depth = currentDisplay;
return newBackground;