Restore ruleset using current playlist item on resuming room sub screen

Ensures that the ruleset selected at the multiplayer song selection
screen does not overwrite the current playlist item's ruleset.
This commit is contained in:
Bartłomiej Dach 2022-01-08 14:55:40 +01:00
parent 446962446e
commit c5ac996e3f
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
1 changed files with 10 additions and 2 deletions

View File

@ -300,6 +300,7 @@ public override void OnResuming(IScreen last)
updateWorkingBeatmap();
beginHandlingTrack();
Scheduler.AddOnce(UpdateMods);
Scheduler.AddOnce(updateRuleset);
}
public override bool OnExiting(IScreen next)
@ -353,8 +354,7 @@ private void selectedItemChanged()
.ToList();
UpdateMods();
Ruleset.Value = rulesets.GetRuleset(selected.RulesetID);
updateRuleset();
if (!selected.AllowedMods.Any())
{
@ -387,6 +387,14 @@ protected virtual void UpdateMods()
Mods.Value = UserMods.Value.Concat(SelectedItem.Value.RequiredMods).ToList();
}
private void updateRuleset()
{
if (SelectedItem.Value == null || !this.IsCurrentScreen())
return;
Ruleset.Value = rulesets.GetRuleset(SelectedItem.Value.RulesetID);
}
private void beginHandlingTrack()
{
Beatmap.BindValueChanged(applyLoopingToTrack, true);