Isolate sample screens from global mods bindable

Fixes scenario wherein entering the first run setup overlay, exiting at
the "UI scale" step (which shows a song select), then moving to actua
song select and trying to select a mod would lead to a crash.

The crash was caused by two active mod screen instances attempting to
swap the global mod bindable's mod instances for ones they owned. This
logic - while generally problematic and hard to maintain - was fixing
several issues with mod reference management and setting copying, so I'm
letting it live another day.

This change will mean that the song select preview on the "UI scale"
step will not receive the same mods that the actual game has enabled.
That said, it already doesn't use the same beatmap or ruleset, so this
looks fine to break.
This commit is contained in:
Bartłomiej Dach 2022-05-07 21:20:00 +02:00
parent 3bb22dece6
commit 46d3220c07
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@ -19,6 +20,7 @@
using osu.Game.Localisation;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select;
@ -131,6 +133,10 @@ private class SampleScreenContainer : CompositeDrawable
[Cached(typeof(IBindable<WorkingBeatmap>))]
protected Bindable<WorkingBeatmap> Beatmap { get; private set; } = new Bindable<WorkingBeatmap>();
[Cached]
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
protected Bindable<IReadOnlyList<Mod>> SelectedMods { get; private set; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
public override bool HandlePositionalInput => false;
public override bool HandleNonPositionalInput => false;
public override bool PropagatePositionalInputSubTree => false;