1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 00:02:54 +08:00

Decouple ModSelectOverlay from global SelectedMods

This commit is contained in:
Dean Herbert 2020-01-30 17:37:52 +09:00
parent fb51ffc169
commit 7bf2e9b369
2 changed files with 14 additions and 3 deletions

View File

@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Mods
protected readonly Container ModSettingsContainer; protected readonly Container ModSettingsContainer;
protected readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); public readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
private Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> availableMods; private Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> availableMods;
@ -321,14 +321,13 @@ namespace osu.Game.Overlays.Mods
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuColour colours, AudioManager audio, Bindable<IReadOnlyList<Mod>> selectedMods, OsuGameBase osu) private void load(OsuColour colours, AudioManager audio, OsuGameBase osu)
{ {
LowMultiplierColour = colours.Red; LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green; HighMultiplierColour = colours.Green;
UnrankedLabel.Colour = colours.Blue; UnrankedLabel.Colour = colours.Blue;
availableMods = osu.AvailableMods.GetBoundCopy(); availableMods = osu.AvailableMods.GetBoundCopy();
SelectedMods.BindTo(selectedMods);
sampleOn = audio.Samples.Get(@"UI/check-on"); sampleOn = audio.Samples.Get(@"UI/check-on");
sampleOff = audio.Samples.Get(@"UI/check-off"); sampleOff = audio.Samples.Get(@"UI/check-off");

View File

@ -75,6 +75,9 @@ namespace osu.Game.Screens.Select
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private NotificationOverlay notificationOverlay { get; set; } private NotificationOverlay notificationOverlay { get; set; }
[Resolved]
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
protected BeatmapCarousel Carousel { get; private set; } protected BeatmapCarousel Carousel { get; private set; }
@ -468,6 +471,8 @@ namespace osu.Game.Screens.Select
this.FadeInFromZero(250); this.FadeInFromZero(250);
FilterControl.Activate(); FilterControl.Activate();
ModSelect.SelectedMods.BindTo(selectedMods);
} }
private const double logo_transition = 250; private const double logo_transition = 250;
@ -508,6 +513,12 @@ namespace osu.Game.Screens.Select
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)
{ {
base.OnResuming(last);
// required due to https://github.com/ppy/osu-framework/issues/3218
ModSelect.SelectedMods.Disabled = false;
ModSelect.SelectedMods.BindTo(selectedMods);
BeatmapDetails.Leaderboard.RefreshScores(); BeatmapDetails.Leaderboard.RefreshScores();
Beatmap.Value.Track.Looping = true; Beatmap.Value.Track.Looping = true;
@ -532,6 +543,7 @@ namespace osu.Game.Screens.Select
public override void OnSuspending(IScreen next) public override void OnSuspending(IScreen next)
{ {
ModSelect.SelectedMods.UnbindFrom(selectedMods);
ModSelect.Hide(); ModSelect.Hide();
BeatmapOptions.Hide(); BeatmapOptions.Hide();