1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

Always use beatmap ruleset in editor gameplay test mode

Fixes cases where opening a convertible beatmap (so any osu! beatmap)
with the game-global ruleset being set to anything but osu! would result
in opening the editor gameplay test mode with the game-global ruleset
rather than the beatmap's.
This commit is contained in:
Bartłomiej Dach 2022-06-19 19:30:34 +02:00
parent def87ed782
commit 93b3ede2a0
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 12 additions and 1 deletions

View File

@ -65,6 +65,7 @@ namespace osu.Game.Screens.Edit
base.LoadComplete();
// will be restored via lease, see `DisallowExternalBeatmapRulesetChanges`.
Ruleset.Value = Beatmap.Value.BeatmapInfo.Ruleset;
Mods.Value = Array.Empty<Mod>();
}

View File

@ -786,7 +786,17 @@ namespace osu.Game.Screens.Select
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.ValueChanged += r =>
{
bool wasDisabled = Ruleset.Disabled;
// a sub-screen may have taken a lease on this decoupled ruleset bindable,
// which would indirectly propagate to the game-global bindable via the `DisabledChanged` callback below.
// to make sure changes sync without crashes, lift the disable for a short while to sync, and then restore the old value.
Ruleset.Disabled = false;
Ruleset.Value = r.NewValue;
Ruleset.Disabled = wasDisabled;
};
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
Beatmap.BindValueChanged(workingBeatmapChanged);