1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-27 19:10:35 +08:00

Merge pull request #33133 from frenzibyte/ssv2-management-interface

SongSelectV2: Expose method for opening editor and clearing local scores
This commit is contained in:
Dean Herbert
2025-05-15 01:56:49 +09:00
committed by GitHub
Unverified
3 changed files with 32 additions and 7 deletions
@@ -15,13 +15,13 @@ namespace osu.Game.Screens.Select
[Resolved]
private ScoreManager scoreManager { get; set; } = null!;
public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action onCompletion)
public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action? onCompletion = null)
{
BodyText = $"All local scores on {beatmapInfo.GetDisplayTitle()}";
DangerousAction = () =>
{
Task.Run(() => scoreManager.Delete(beatmapInfo))
.ContinueWith(_ => onCompletion);
.ContinueWith(_ => onCompletion?.Invoke());
};
}
}
@@ -2,13 +2,30 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.SelectV2
{
public partial class SoloSongSelect : SongSelect
{
[Resolved]
private BeatmapManager beatmaps { get; set; } = null!;
/// <summary>
/// Opens beatmap editor with the given beatmap.
/// </summary>
public void Edit(BeatmapInfo beatmap)
{
// Forced refetch is important here to guarantee correct invalidation across all difficulties.
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, true);
this.Push(new EditorLoader());
}
protected override bool OnStart()
{
this.Push(new PlayerLoaderV2(() => new SoloPlayer()));
+13 -5
View File
@@ -75,7 +75,7 @@ namespace osu.Game.Screens.SelectV2
private OsuLogo? logo { get; set; }
[Resolved]
private IDialogOverlay? dialogs { get; set; }
private IDialogOverlay? dialogOverlay { get; set; }
[BackgroundDependencyLoader]
private void load()
@@ -346,11 +346,19 @@ namespace osu.Game.Screens.SelectV2
#region Beatmap management
/// <summary>
/// Opens up <see cref="BeatmapDeleteDialog"/> with the given beatmap set.
/// Requests the user for confirmation to delete the given beatmap set.
/// </summary>
public void RequestDeleteBeatmap(BeatmapSetInfo set)
public void DeleteBeatmap(BeatmapSetInfo beatmapSet)
{
dialogs?.Push(new BeatmapDeleteDialog(set));
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmapSet));
}
/// <summary>
/// Requests the user for confirmation to clear all local scores in the given beatmap.
/// </summary>
public void ClearScores(BeatmapInfo beatmap)
{
dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap));
}
#endregion
@@ -387,7 +395,7 @@ namespace osu.Game.Screens.SelectV2
if (e.ShiftPressed)
{
if (!Beatmap.IsDefault)
RequestDeleteBeatmap(Beatmap.Value.BeatmapSetInfo);
DeleteBeatmap(Beatmap.Value.BeatmapSetInfo);
return true;
}