1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Merge pull request #13509 from bdach/fix-seasonal-backgrounds

Fix seasonal backgrounds not cycling
This commit is contained in:
Dean Herbert 2021-06-16 15:26:46 +09:00 committed by GitHub
commit cb80577922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -161,15 +161,18 @@ namespace osu.Game.Tests.Visual.Background
private void loadNextBackground() private void loadNextBackground()
{ {
SeasonalBackground previousBackground = null;
SeasonalBackground background = null; SeasonalBackground background = null;
AddStep("create next background", () => AddStep("create next background", () =>
{ {
previousBackground = (SeasonalBackground)backgroundContainer.SingleOrDefault();
background = backgroundLoader.LoadNextBackground(); background = backgroundLoader.LoadNextBackground();
LoadComponentAsync(background, bg => backgroundContainer.Child = bg); LoadComponentAsync(background, bg => backgroundContainer.Child = bg);
}); });
AddUntilStep("background loaded", () => background.IsLoaded); AddUntilStep("background loaded", () => background.IsLoaded);
AddAssert("background is different", () => !background.Equals(previousBackground));
} }
private void assertAnyBackground() private void assertAnyBackground()

View File

@ -99,5 +99,14 @@ namespace osu.Game.Graphics.Backgrounds
// ensure we're not loading in without a transition. // ensure we're not loading in without a transition.
this.FadeInFromZero(200, Easing.InOutSine); this.FadeInFromZero(200, Easing.InOutSine);
} }
public override bool Equals(Background other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return other.GetType() == GetType()
&& ((SeasonalBackground)other).url == url;
}
} }
} }