mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 04:42:55 +08:00
Merge pull request #22227 from OliBomby/carousel
Change beatmap context menu items in OnlinePlaySongSelect
This commit is contained in:
commit
02c74f5fb4
@ -47,8 +47,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private Sprite background = null!;
|
||||
|
||||
private Action<BeatmapInfo>? startRequested;
|
||||
private Action<BeatmapInfo>? editRequested;
|
||||
private MenuItem[]? mainMenuItems;
|
||||
|
||||
private Action<BeatmapInfo>? selectRequested;
|
||||
private Action<BeatmapInfo>? hideRequested;
|
||||
|
||||
private Triangles triangles = null!;
|
||||
@ -84,9 +85,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
if (songSelect != null)
|
||||
{
|
||||
startRequested = b => songSelect.FinaliseSelection(b);
|
||||
if (songSelect.AllowEditing)
|
||||
editRequested = songSelect.Edit;
|
||||
mainMenuItems = songSelect.CreateForwardNavigationMenuItemsForBeatmap(beatmapInfo);
|
||||
selectRequested = b => songSelect.FinaliseSelection(b);
|
||||
}
|
||||
|
||||
if (manager != null)
|
||||
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (Item?.State.Value == CarouselItemState.Selected)
|
||||
startRequested?.Invoke(beatmapInfo);
|
||||
selectRequested?.Invoke(beatmapInfo);
|
||||
|
||||
return base.OnClick(e);
|
||||
}
|
||||
@ -227,11 +227,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (startRequested != null)
|
||||
items.Add(new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested(beatmapInfo)));
|
||||
|
||||
if (editRequested != null)
|
||||
items.Add(new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Standard, () => editRequested(beatmapInfo)));
|
||||
if (mainMenuItems != null)
|
||||
items.AddRange(mainMenuItems);
|
||||
|
||||
if (beatmapInfo.OnlineID > 0 && beatmapOverlay != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID)));
|
||||
|
@ -4,10 +4,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
@ -30,6 +34,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
public override MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[]
|
||||
{
|
||||
new OsuMenuItem(ButtonSystemStrings.Play.ToSentence(), MenuItemType.Highlighted, () => FinaliseSelection(beatmap)),
|
||||
new OsuMenuItem(ButtonSystemStrings.Edit.ToSentence(), MenuItemType.Standard, () => Edit(beatmap))
|
||||
};
|
||||
|
||||
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
|
||||
|
||||
private PlayBeatmapDetailArea playBeatmapDetailArea = null!;
|
||||
@ -37,7 +47,7 @@ namespace osu.Game.Screens.Select
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit());
|
||||
BeatmapOptions.AddButton(ButtonSystemStrings.Edit.ToSentence(), @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit());
|
||||
}
|
||||
|
||||
protected void PresentScore(ScoreInfo score) =>
|
||||
|
@ -1,19 +1,31 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
@ -21,23 +33,12 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -83,6 +84,17 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public bool BeatmapSetsLoaded => IsLoaded && Carousel.BeatmapSetsLoaded;
|
||||
|
||||
/// <summary>
|
||||
/// Creates any "action" menu items for the provided beatmap (ie. "Select", "Play", "Edit").
|
||||
/// These will always be placed at the top of the context menu, with common items added below them.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The beatmap to create items for.</param>
|
||||
/// <returns>The menu items.</returns>
|
||||
public virtual MenuItem[] CreateForwardNavigationMenuItemsForBeatmap(BeatmapInfo beatmap) => new MenuItem[]
|
||||
{
|
||||
new OsuMenuItem(@"Select", MenuItemType.Highlighted, () => FinaliseSelection(beatmap))
|
||||
};
|
||||
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user