Fix BackgroundScreenDefault incorrectly updating current background after being inactive

If the beatmap was changed but then reverted to the previously displayed
map, the background may have displayed incorrectly on resuming.

Closes #15804.
This commit is contained in:
Dean Herbert 2021-12-14 15:17:01 +09:00
parent 25a056dfad
commit 8c6f50ddb1

View File

@ -48,16 +48,19 @@ namespace osu.Game.Screens.Backgrounds
AddInternal(seasonalBackgroundLoader);
user.ValueChanged += _ => Next();
skin.ValueChanged += _ => Next();
mode.ValueChanged += _ => Next();
beatmap.ValueChanged += _ => Next();
introSequence.ValueChanged += _ => Next();
seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Next();
user.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired);
skin.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired);
mode.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired);
beatmap.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired);
introSequence.ValueChanged += _ => Scheduler.AddOnce(loadNextIfRequired);
seasonalBackgroundLoader.SeasonalBackgroundChanged += () => Scheduler.AddOnce(loadNextIfRequired);
currentDisplay = RNG.Next(0, background_count);
Next();
// helper function required for AddOnce usage.
void loadNextIfRequired() => Next();
}
private ScheduledDelegate nextTask;