1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 23:30:51 +08:00

Merge pull request #4585 from Eclmist/bugfix/4584

Hides "Details" button when OnlineBeatmapID is null

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert
2019-04-04 01:54:22 +09:00
committed by GitHub
Unverified
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@@ -168,15 +169,22 @@ namespace osu.Game.Screens.Select.Carousel
base.ApplyState();
}
public MenuItem[] ContextMenuItems => new MenuItem[]
public MenuItem[] ContextMenuItems
{
new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)),
new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)),
new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)),
new OsuMenuItem("Details", MenuItemType.Standard, () =>
get
{
if (beatmap.OnlineBeatmapID.HasValue) beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value);
}),
};
List<MenuItem> items = new List<MenuItem>
{
new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)),
new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)),
new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)),
};
if (beatmap.OnlineBeatmapID.HasValue)
items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value)));
return items.ToArray();
}
}
}
}