Directly bypass beatmap/ruleset restrictions

This commit is contained in:
smoogipoo
2018-12-18 14:17:20 +09:00
parent 8d640cdc25
commit 5a8b255bd8

View File

@ -32,10 +32,9 @@ namespace osu.Game.Screens.Multi.Match
private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>(); private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>();
private readonly BindableCollection<PlaylistItem> playlistBind = new BindableCollection<PlaylistItem>(); private readonly BindableCollection<PlaylistItem> playlistBind = new BindableCollection<PlaylistItem>();
protected override Drawable TransitionContent => participants; public override bool AllowBeatmapRulesetChange => false;
public override bool AllowBeatmapRulesetChange => allowBeatmapRulesetChange; protected override Drawable TransitionContent => participants;
private bool allowBeatmapRulesetChange;
public override string Title => room.Name.Value; public override string Title => room.Name.Value;
@ -164,19 +163,21 @@ namespace osu.Game.Screens.Multi.Match
info.Beatmap.Value = item.Beatmap; info.Beatmap.Value = item.Beatmap;
info.Mods.Value = item.RequiredMods; info.Mods.Value = item.RequiredMods;
allowBeatmapRulesetChange = true;
// Todo: item.Beatmap can be null here... // Todo: item.Beatmap can be null here...
var localBeatmap = beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == item.BeatmapID) ?? item.Beatmap; var localBeatmap = beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == item.BeatmapID) ?? item.Beatmap;
Schedule(() => // Bypass any beatmap and ruleset restrictions
{ var beatmapDisabled = Beatmap.Disabled;
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap); var rulesetDisabled = Ruleset.Disabled;
Beatmap.Value.Mods.Value = item.RequiredMods.ToArray(); Beatmap.Disabled = false;
Ruleset.Value = item.Ruleset; Ruleset.Disabled = false;
allowBeatmapRulesetChange = false; Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
}); Beatmap.Value.Mods.Value = item.RequiredMods.ToArray();
Ruleset.Value = item.Ruleset;
Beatmap.Disabled = beatmapDisabled;
Ruleset.Disabled = rulesetDisabled;
} }
private void onStart() private void onStart()