mirror of
https://github.com/osukey/osukey.git
synced 2025-05-24 15:07:20 +09:00
Merge pull request #2129 from peppy/fix-mod-select
Fix bindings not being unbound on ModSelect
This commit is contained in:
commit
43ecda2889
@ -65,6 +65,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Ruleset.TriggerChange();
|
Ruleset.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
Ruleset.UnbindAll();
|
||||||
|
SelectedMods.UnbindAll();
|
||||||
|
}
|
||||||
|
|
||||||
private void selectedModsChanged(IEnumerable<Mod> obj)
|
private void selectedModsChanged(IEnumerable<Mod> obj)
|
||||||
{
|
{
|
||||||
foreach (ModSection section in ModSectionsContainer.Children)
|
foreach (ModSection section in ModSectionsContainer.Children)
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -47,13 +49,15 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private SampleChannel sampleConfirm;
|
private SampleChannel sampleConfirm;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
||||||
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame game)
|
|
||||||
{
|
|
||||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
|
||||||
|
|
||||||
if (game != null)
|
[BackgroundDependencyLoader(true)]
|
||||||
modSelect.SelectedMods.BindTo(game.SelectedMods);
|
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu)
|
||||||
|
{
|
||||||
|
if (osu != null) SelectedMods.BindTo(osu.SelectedMods);
|
||||||
|
modSelect.SelectedMods.BindTo(SelectedMods);
|
||||||
|
|
||||||
|
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||||
|
|
||||||
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
||||||
|
|
||||||
@ -80,7 +84,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.UpdateBeatmap(beatmap);
|
base.UpdateBeatmap(beatmap);
|
||||||
|
|
||||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
beatmap.Mods.BindTo(SelectedMods);
|
||||||
|
|
||||||
BeatmapDetails.Beatmap = beatmap;
|
BeatmapDetails.Beatmap = beatmap;
|
||||||
|
|
||||||
@ -95,7 +99,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (removeAutoModOnResume)
|
if (removeAutoModOnResume)
|
||||||
{
|
{
|
||||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
||||||
modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
|
SelectedMods.Value = SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
|
||||||
removeAutoModOnResume = false;
|
removeAutoModOnResume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +129,7 @@ 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;
|
||||||
|
|
||||||
Beatmap.Value.Mods.UnbindBindings();
|
SelectedMods.UnbindAll();
|
||||||
Beatmap.Value.Mods.Value = new Mod[] { };
|
Beatmap.Value.Mods.Value = new Mod[] { };
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user