1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 10:22:56 +08:00

Merge pull request #20072 from peppy/fix-seasonal-background-sticking

Fix seasonal background not being unloaded when changing setting to "Never"
This commit is contained in:
Dan Balasescu 2022-09-01 22:44:43 +09:00 committed by GitHub
commit 8b2652702a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,21 +38,19 @@ namespace osu.Game.Graphics.Backgrounds
private void load(OsuConfigManager config, SessionStatics sessionStatics)
{
seasonalBackgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
seasonalBackgroundMode.BindValueChanged(_ => triggerSeasonalBackgroundChanged());
seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());
seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
seasonalBackgrounds.BindValueChanged(_ => triggerSeasonalBackgroundChanged());
seasonalBackgrounds.BindValueChanged(_ =>
{
if (shouldShowSeasonal)
SeasonalBackgroundChanged?.Invoke();
});
apiState.BindTo(api.State);
apiState.BindValueChanged(fetchSeasonalBackgrounds, true);
}
private void triggerSeasonalBackgroundChanged()
{
if (shouldShowSeasonal)
SeasonalBackgroundChanged?.Invoke();
}
private void fetchSeasonalBackgrounds(ValueChangedEvent<APIState> stateChanged)
{
if (seasonalBackgrounds.Value != null || stateChanged.NewValue != APIState.Online)