diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs index f89f22bf23..23feb1466e 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneFilterControl.cs @@ -231,7 +231,7 @@ namespace osu.Game.Tests.Visual.SongSelect InputManager.Click(MouseButton.Left); }); - private IEnumerable.DropdownMenu.DrawableDropdownMenuItem> getCollectionDropdownItems() - => control.ChildrenOfType().Single().ChildrenOfType.DropdownMenu.DrawableDropdownMenuItem>(); + private IEnumerable.DropdownMenu.DrawableDropdownMenuItem> getCollectionDropdownItems() + => control.ChildrenOfType().Single().ChildrenOfType.DropdownMenu.DrawableDropdownMenuItem>(); } } diff --git a/osu.Game/Screens/Select/CollectionFilterDropdown.cs b/osu.Game/Screens/Select/CollectionFilterDropdown.cs index 1e2a3d0aa7..b08c3b167d 100644 --- a/osu.Game/Screens/Select/CollectionFilterDropdown.cs +++ b/osu.Game/Screens/Select/CollectionFilterDropdown.cs @@ -21,13 +21,13 @@ using osuTK; namespace osu.Game.Screens.Select { /// - /// A dropdown to select the to filter beatmaps using. + /// A dropdown to select the to filter beatmaps using. /// - public class CollectionFilterDropdown : OsuDropdown + public class CollectionFilterDropdown : OsuDropdown { private readonly IBindableList collections = new BindableList(); private readonly IBindableList beatmaps = new BindableList(); - private readonly BindableList filters = new BindableList(); + private readonly BindableList filters = new BindableList(); [Resolved(CanBeNull = true)] private ManageCollectionsDialog manageCollectionsDialog { get; set; } @@ -62,17 +62,17 @@ namespace osu.Game.Screens.Select var selectedItem = SelectedItem?.Value?.Collection; filters.Clear(); - filters.Add(new AllBeatmapCollectionFilter()); - filters.AddRange(collections.Select(c => new CollectionFilter(c))); - filters.Add(new ManageCollectionsFilter()); + filters.Add(new AllBeatmapsCollectionMenuItem()); + filters.AddRange(collections.Select(c => new CollectionMenuItem(c))); + filters.Add(new ManageCollectionsMenuItem()); Current.Value = filters.SingleOrDefault(f => f.Collection != null && f.Collection == selectedItem) ?? filters[0]; } /// - /// Occurs when the selection has changed. + /// Occurs when the selection has changed. /// - private void filterChanged(ValueChangedEvent filter) + private void filterChanged(ValueChangedEvent filter) { // Binding the beatmaps will trigger a collection change event, which results in an infinite-loop. This is rebound later, when it's safe to do so. beatmaps.CollectionChanged -= filterBeatmapsChanged; @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Select // Never select the manage collection filter - rollback to the previous filter. // This is done after the above since it is important that bindable is unbound from OldValue, which is lost after forcing it back to the old value. - if (filter.NewValue is ManageCollectionsFilter) + if (filter.NewValue is ManageCollectionsMenuItem) { Current.Value = filter.OldValue; manageCollectionsDialog?.Show(); @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Select Current.TriggerChange(); } - protected override string GenerateItemText(CollectionFilter item) => item.CollectionName.Value; + protected override string GenerateItemText(CollectionMenuItem item) => item.CollectionName.Value; protected override DropdownHeader CreateHeader() => new CollectionDropdownHeader { @@ -115,7 +115,7 @@ namespace osu.Game.Screens.Select public class CollectionDropdownHeader : OsuDropdownHeader { - public readonly Bindable SelectedItem = new Bindable(); + public readonly Bindable SelectedItem = new Bindable(); private readonly Bindable collectionName = new Bindable(); protected override string Label @@ -165,7 +165,7 @@ namespace osu.Game.Screens.Select private class CollectionDropdownMenuItem : OsuDropdownMenu.DrawableOsuDropdownMenuItem { [NotNull] - protected new CollectionFilter Item => ((DropdownMenuItem)base.Item).Value; + protected new CollectionMenuItem Item => ((DropdownMenuItem)base.Item).Value; [Resolved] private OsuColour colours { get; set; } diff --git a/osu.Game/Screens/Select/CollectionFilter.cs b/osu.Game/Screens/Select/CollectionMenuItem.cs similarity index 60% rename from osu.Game/Screens/Select/CollectionFilter.cs rename to osu.Game/Screens/Select/CollectionMenuItem.cs index 883019ab06..995651de19 100644 --- a/osu.Game/Screens/Select/CollectionFilter.cs +++ b/osu.Game/Screens/Select/CollectionMenuItem.cs @@ -1,10 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using JetBrains.Annotations; using osu.Framework.Bindables; -using osu.Game.Beatmaps; using osu.Game.Collections; namespace osu.Game.Screens.Select @@ -12,7 +10,7 @@ namespace osu.Game.Screens.Select /// /// A filter. /// - public class CollectionFilter + public class CollectionMenuItem { /// /// The collection to filter beatmaps from. @@ -28,35 +26,27 @@ namespace osu.Game.Screens.Select public readonly Bindable CollectionName; /// - /// Creates a new . + /// Creates a new . /// /// The collection to filter beatmaps from. - public CollectionFilter([CanBeNull] BeatmapCollection collection) + public CollectionMenuItem([CanBeNull] BeatmapCollection collection) { Collection = collection; CollectionName = Collection?.Name.GetBoundCopy() ?? new Bindable("All beatmaps"); } - - /// - /// Whether the collection contains a given beatmap. - /// - /// The beatmap to check. - /// Whether contains . - public virtual bool ContainsBeatmap(BeatmapInfo beatmap) - => Collection?.Beatmaps.Any(b => b.Equals(beatmap)) ?? true; } - public class AllBeatmapCollectionFilter : CollectionFilter + public class AllBeatmapsCollectionMenuItem : CollectionMenuItem { - public AllBeatmapCollectionFilter() + public AllBeatmapsCollectionMenuItem() : base(null) { } } - public class ManageCollectionsFilter : CollectionFilter + public class ManageCollectionsMenuItem : CollectionMenuItem { - public ManageCollectionsFilter() + public ManageCollectionsMenuItem() : base(null) { CollectionName.Value = "Manage collections...";