Skip to content

Commit

Permalink
Merge pull request #20072 from peppy/fix-seasonal-background-sticking
Browse files Browse the repository at this point in the history
Fix seasonal background not being unloaded when changing setting to "Never"
  • Loading branch information
smoogipoo authored Sep 1, 2022
2 parents 5ca6395 + 8866250 commit 8b26527
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 8b26527

Please sign in to comment.