1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 06:52:55 +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,19 +38,17 @@ namespace osu.Game.Graphics.Backgrounds
private void load(OsuConfigManager config, SessionStatics sessionStatics) private void load(OsuConfigManager config, SessionStatics sessionStatics)
{ {
seasonalBackgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode); seasonalBackgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
seasonalBackgroundMode.BindValueChanged(_ => triggerSeasonalBackgroundChanged()); seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());
seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds); seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
seasonalBackgrounds.BindValueChanged(_ => triggerSeasonalBackgroundChanged()); seasonalBackgrounds.BindValueChanged(_ =>
apiState.BindTo(api.State);
apiState.BindValueChanged(fetchSeasonalBackgrounds, true);
}
private void triggerSeasonalBackgroundChanged()
{ {
if (shouldShowSeasonal) if (shouldShowSeasonal)
SeasonalBackgroundChanged?.Invoke(); SeasonalBackgroundChanged?.Invoke();
});
apiState.BindTo(api.State);
apiState.BindValueChanged(fetchSeasonalBackgrounds, true);
} }
private void fetchSeasonalBackgrounds(ValueChangedEvent<APIState> stateChanged) private void fetchSeasonalBackgrounds(ValueChangedEvent<APIState> stateChanged)