Skip to content

Commit

Permalink
Fix seasonal background not being unloaded when changing setting to "…
Browse files Browse the repository at this point in the history
…Never"

Closes #20065.
  • Loading branch information
peppy committed Sep 1, 2022
1 parent db9970b commit 8866250
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,19 @@ public class SeasonalBackgroundLoader : Component
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)
Expand Down

0 comments on commit 8866250

Please sign in to comment.