mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Merge branch 'master' into fix-hidden-slider-heads
This commit is contained in:
commit
f213f38997
@ -207,6 +207,12 @@ namespace osu.Game.Tests.Visual
|
||||
checkVisibleItemCount(true, 0);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
advanceSelection(true);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
advanceSelection(false);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||
|
||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||
|
@ -65,6 +65,14 @@ namespace osu.Game.Overlays.Mods
|
||||
Ruleset.TriggerChange();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
Ruleset.UnbindAll();
|
||||
SelectedMods.UnbindAll();
|
||||
}
|
||||
|
||||
private void selectedModsChanged(IEnumerable<Mod> obj)
|
||||
{
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
|
@ -192,7 +192,9 @@ namespace osu.Game.Screens.Select
|
||||
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||
{
|
||||
if (!Items.Any())
|
||||
var visibleItems = Items.Where(s => !s.Item.Filtered).ToList();
|
||||
|
||||
if (!visibleItems.Any())
|
||||
return;
|
||||
|
||||
DrawableCarouselItem drawable = null;
|
||||
@ -202,15 +204,15 @@ namespace osu.Game.Screens.Select
|
||||
// we can fix this by changing this method to not reference drawables / Items in the first place.
|
||||
return;
|
||||
|
||||
int originalIndex = Items.IndexOf(drawable);
|
||||
int originalIndex = visibleItems.IndexOf(drawable);
|
||||
int currentIndex = originalIndex;
|
||||
|
||||
// local function to increment the index in the required direction, wrapping over extremities.
|
||||
int incrementIndex() => currentIndex = (currentIndex + direction + Items.Count) % Items.Count;
|
||||
int incrementIndex() => currentIndex = (currentIndex + direction + visibleItems.Count) % visibleItems.Count;
|
||||
|
||||
while (incrementIndex() != originalIndex)
|
||||
{
|
||||
var item = Items[currentIndex].Item;
|
||||
var item = visibleItems[currentIndex].Item;
|
||||
|
||||
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
@ -47,13 +49,15 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private SampleChannel sampleConfirm;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame game)
|
||||
{
|
||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
||||
|
||||
if (game != null)
|
||||
modSelect.SelectedMods.BindTo(game.SelectedMods);
|
||||
[BackgroundDependencyLoader(true)]
|
||||
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);
|
||||
|
||||
@ -80,7 +84,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.UpdateBeatmap(beatmap);
|
||||
|
||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
||||
beatmap.Mods.BindTo(SelectedMods);
|
||||
|
||||
BeatmapDetails.Beatmap = beatmap;
|
||||
|
||||
@ -95,7 +99,7 @@ namespace osu.Game.Screens.Select
|
||||
if (removeAutoModOnResume)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -125,7 +129,7 @@ namespace osu.Game.Screens.Select
|
||||
if (Beatmap.Value.Track != null)
|
||||
Beatmap.Value.Track.Looping = false;
|
||||
|
||||
Beatmap.Value.Mods.UnbindBindings();
|
||||
SelectedMods.UnbindAll();
|
||||
Beatmap.Value.Mods.Value = new Mod[] { };
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user