mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge pull request #8768 from Joehuu/hide-edit-item-multiplayer
Hide edit context menu item in multiplayer song select
This commit is contained in:
commit
4abb85023f
@ -49,12 +49,13 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(SongSelect songSelect, BeatmapManager manager)
|
||||
private void load(BeatmapManager manager, SongSelect songSelect)
|
||||
{
|
||||
if (songSelect != null)
|
||||
{
|
||||
startRequested = b => songSelect.FinaliseSelection(b);
|
||||
editRequested = songSelect.Edit;
|
||||
if (songSelect.AllowEditing)
|
||||
editRequested = songSelect.Edit;
|
||||
}
|
||||
|
||||
if (manager != null)
|
||||
@ -187,15 +188,19 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
get
|
||||
{
|
||||
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)),
|
||||
};
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (beatmap.OnlineBeatmapID.HasValue)
|
||||
items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value)));
|
||||
if (startRequested != null)
|
||||
items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested(beatmap)));
|
||||
|
||||
if (editRequested != null)
|
||||
items.Add(new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested(beatmap)));
|
||||
|
||||
if (hideRequested != null)
|
||||
items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmap)));
|
||||
|
||||
if (beatmap.OnlineBeatmapID.HasValue && beatmapOverlay != null)
|
||||
items.Add(new OsuMenuItem("Details", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value)));
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay)
|
||||
{
|
||||
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
|
||||
|
||||
if (beatmapOverlay != null)
|
||||
viewDetails = beatmapOverlay.FetchAndShowBeatmapSet;
|
||||
|
||||
@ -131,13 +132,14 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
if (Item.State.Value == CarouselItemState.NotSelected)
|
||||
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
|
||||
|
||||
if (beatmapSet.OnlineBeatmapSetID != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails?.Invoke(beatmapSet.OnlineBeatmapSetID.Value)));
|
||||
if (beatmapSet.OnlineBeatmapSetID != null && viewDetails != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails(beatmapSet.OnlineBeatmapSetID.Value)));
|
||||
|
||||
if (beatmapSet.Beatmaps.Any(b => b.Hidden))
|
||||
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested?.Invoke(beatmapSet)));
|
||||
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested(beatmapSet)));
|
||||
|
||||
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapDeleteDialog(beatmapSet))));
|
||||
if (dialogOverlay != null)
|
||||
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay.Push(new BeatmapDeleteDialog(beatmapSet))));
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -71,9 +70,6 @@ namespace osu.Game.Screens.Select
|
||||
/// </summary>
|
||||
public virtual bool AllowEditing => true;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private NotificationOverlay notificationOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; }
|
||||
|
||||
@ -329,10 +325,7 @@ namespace osu.Game.Screens.Select
|
||||
public void Edit(BeatmapInfo beatmap = null)
|
||||
{
|
||||
if (!AllowEditing)
|
||||
{
|
||||
notificationOverlay?.Post(new SimpleNotification { Text = "Editing is not available from the current mode." });
|
||||
return;
|
||||
}
|
||||
throw new InvalidOperationException($"Attempted to edit when {nameof(AllowEditing)} is disabled");
|
||||
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
||||
this.Push(new Editor());
|
||||
|
Loading…
Reference in New Issue
Block a user