mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 00:52:56 +08:00
Allow starting maps by clicking an active panel a second time.
This commit is contained in:
parent
2cbc528971
commit
6e10a9bb29
@ -19,6 +19,11 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
||||||
|
/// </summary>
|
||||||
|
public Action<BeatmapInfo> StartRequested;
|
||||||
|
|
||||||
public BeatmapSetHeader Header;
|
public BeatmapSetHeader Header;
|
||||||
|
|
||||||
private BeatmapGroupState state;
|
private BeatmapGroupState state;
|
||||||
@ -68,6 +73,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
GainedSelection = panelGainedSelection,
|
GainedSelection = panelGainedSelection,
|
||||||
|
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Game.Graphics.Backgrounds;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
@ -25,6 +26,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
private Sprite background;
|
private Sprite background;
|
||||||
|
|
||||||
public Action<BeatmapPanel> GainedSelection;
|
public Action<BeatmapPanel> GainedSelection;
|
||||||
|
public Action<BeatmapPanel> StartRequested;
|
||||||
|
|
||||||
Color4 deselectedColour = new Color4(20, 43, 51, 255);
|
Color4 deselectedColour = new Color4(20, 43, 51, 255);
|
||||||
|
|
||||||
@ -45,6 +47,14 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
background.Colour = deselectedColour;
|
background.Colour = deselectedColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
if (State == PanelSelectedState.Selected)
|
||||||
|
StartRequested?.Invoke(this);
|
||||||
|
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
|
||||||
public BeatmapPanel(BeatmapInfo beatmap)
|
public BeatmapPanel(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
|
@ -348,7 +348,11 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);
|
var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);
|
||||||
|
|
||||||
var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged };
|
var group = new BeatmapGroup(beatmap)
|
||||||
|
{
|
||||||
|
SelectionChanged = selectionChanged,
|
||||||
|
StartRequested = b => start()
|
||||||
|
};
|
||||||
|
|
||||||
//for the time being, let's completely load the difficulty panels in the background.
|
//for the time being, let's completely load the difficulty panels in the background.
|
||||||
//this likely won't scale so well, but allows us to completely async the loading flow.
|
//this likely won't scale so well, but allows us to completely async the loading flow.
|
||||||
|
Loading…
Reference in New Issue
Block a user