diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 8efad451df..e3981c85f0 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -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()); }; } } diff --git a/osu.Game/Screens/SelectV2/SoloSongSelect.cs b/osu.Game/Screens/SelectV2/SoloSongSelect.cs index e6ecdc6705..7e26fc1e32 100644 --- a/osu.Game/Screens/SelectV2/SoloSongSelect.cs +++ b/osu.Game/Screens/SelectV2/SoloSongSelect.cs @@ -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!; + + /// + /// Opens beatmap editor with the given beatmap. + /// + 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())); diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index ecf2111cbd..b9898e841d 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -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 /// - /// Opens up with the given beatmap set. + /// Requests the user for confirmation to delete the given beatmap set. /// - public void RequestDeleteBeatmap(BeatmapSetInfo set) + public void DeleteBeatmap(BeatmapSetInfo beatmapSet) { - dialogs?.Push(new BeatmapDeleteDialog(set)); + dialogOverlay?.Push(new BeatmapDeleteDialog(beatmapSet)); + } + + /// + /// Requests the user for confirmation to clear all local scores in the given beatmap. + /// + 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; }