1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:33:20 +08:00

Add beatmap details menu item to playlist items

This commit is contained in:
Salman Ahmed 2022-07-14 02:45:31 +03:00
parent 728487b7fb
commit 036e64382f

View File

@ -30,6 +30,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online; using osu.Game.Online;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapSet; using osu.Game.Overlays.BeatmapSet;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -107,6 +108,9 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved] [Resolved]
private BeatmapLookupCache beatmapLookupCache { get; set; } private BeatmapLookupCache beatmapLookupCache { get; set; }
[Resolved(CanBeNull = true)]
private BeatmapSetOverlay beatmapOverlay { get; set; }
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private CollectionManager collectionManager { get; set; } private CollectionManager collectionManager { get; set; }
@ -496,9 +500,10 @@ namespace osu.Game.Screens.OnlinePlay
{ {
List<MenuItem> items = new List<MenuItem>(); List<MenuItem> items = new List<MenuItem>();
if (beatmap != null && collectionManager != null) if (beatmapOverlay != null)
{ items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID)));
if (downloadTracker.State.Value == DownloadState.LocallyAvailable)
if (beatmap != null && collectionManager != null && downloadTracker.State.Value == DownloadState.LocallyAvailable)
{ {
var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast<OsuMenuItem>().ToList(); var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast<OsuMenuItem>().ToList();
if (manageCollectionsDialog != null) if (manageCollectionsDialog != null)
@ -506,9 +511,6 @@ namespace osu.Game.Screens.OnlinePlay
items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
} }
else
items.Add(new OsuMenuItem("Download to add to collection") { Action = { Disabled = true } });
}
return items.ToArray(); return items.ToArray();
} }