Change background to seasonal right after login

This commit is contained in:
Bartłomiej Dach
2020-10-30 22:03:26 +01:00
parent 29ad099902
commit 38cf90a69b
2 changed files with 10 additions and 3 deletions

View File

@ -18,6 +18,12 @@ namespace osu.Game.Graphics.Backgrounds
[LongRunningLoad]
public class SeasonalBackgroundLoader : Component
{
/// <summary>
/// Fired when background change should be changed due to receiving backgrounds from API
/// or when the user setting is changed (as it might require unloading the seasonal background).
/// </summary>
public event Action SeasonalBackgroundChanged;
[Resolved]
private IAPIProvider api { get; set; }
@ -31,7 +37,10 @@ namespace osu.Game.Graphics.Backgrounds
private void load(OsuConfigManager config, SessionStatics sessionStatics)
{
seasonalBackgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
seasonalBackgroundMode.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());
seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
seasonalBackgrounds.BindValueChanged(_ => SeasonalBackgroundChanged?.Invoke());
apiState.BindTo(api.State);
apiState.BindValueChanged(fetchSeasonalBackgrounds, true);