1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Remove local bindable at song select, along with misplaced reset logic

This commit is contained in:
Dean Herbert 2019-11-14 13:29:06 +09:00
parent 1109d201c3
commit c15f909d83

View File

@ -30,7 +30,6 @@ using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Input; using osuTK.Input;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -86,10 +85,6 @@ namespace osu.Game.Screens.Select
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private MusicController music { get; set; } private MusicController music { get; set; }
[Cached]
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
protected SongSelect() protected SongSelect()
{ {
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
@ -222,7 +217,7 @@ namespace osu.Game.Screens.Select
{ {
if (Footer != null) if (Footer != null)
{ {
Footer.AddButton(new FooterButtonMods { Current = mods }, ModSelect); Footer.AddButton(new FooterButtonMods { Current = Mods }, ModSelect);
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom }); Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions); Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
@ -262,13 +257,6 @@ namespace osu.Game.Screens.Select
} }
} }
protected override void LoadComplete()
{
base.LoadComplete();
mods.BindTo(Mods);
}
private DependencyContainer dependencies; private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
@ -390,7 +378,7 @@ namespace osu.Game.Screens.Select
{ {
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\""); Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
mods.Value = Array.Empty<Mod>(); Mods.Value = Array.Empty<Mod>();
decoupledRuleset.Value = ruleset; decoupledRuleset.Value = ruleset;
// force a filter before attempting to change the beatmap. // force a filter before attempting to change the beatmap.
@ -538,9 +526,6 @@ namespace osu.Game.Screens.Select
if (Beatmap.Value.Track != null) if (Beatmap.Value.Track != null)
Beatmap.Value.Track.Looping = false; Beatmap.Value.Track.Looping = false;
mods.UnbindAll();
Mods.Value = Array.Empty<Mod>();
return false; return false;
} }