1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 17:27:39 +08:00
osu-lazer/osu.Game/Screens/Select/CollectionMenuItem.cs
2020-09-09 23:11:19 +09:00

56 lines
1.6 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Game.Collections;
namespace osu.Game.Screens.Select
{
/// <summary>
/// A <see cref="BeatmapCollection"/> filter.
/// </summary>
public class CollectionMenuItem
{
/// <summary>
/// The collection to filter beatmaps from.
/// May be null to not filter by collection (include all beatmaps).
/// </summary>
[CanBeNull]
public readonly BeatmapCollection Collection;
/// <summary>
/// The name of the collection.
/// </summary>
[NotNull]
public readonly Bindable<string> CollectionName;
/// <summary>
/// Creates a new <see cref="CollectionMenuItem"/>.
/// </summary>
/// <param name="collection">The collection to filter beatmaps from.</param>
public CollectionMenuItem([CanBeNull] BeatmapCollection collection)
{
Collection = collection;
CollectionName = Collection?.Name.GetBoundCopy() ?? new Bindable<string>("All beatmaps");
}
}
public class AllBeatmapsCollectionMenuItem : CollectionMenuItem
{
public AllBeatmapsCollectionMenuItem()
: base(null)
{
}
}
public class ManageCollectionsMenuItem : CollectionMenuItem
{
public ManageCollectionsMenuItem()
: base(null)
{
CollectionName.Value = "Manage collections...";
}
}
}