diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 3e5096b051..ccac748535 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . 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.Linq; using osu.Framework.Allocation; @@ -54,9 +55,11 @@ namespace osu.Game.Online.Leaderboards private FillFlowContainer modsContainer; private List statisticsLabels; - + private DialogOverlay dialogOverlay; + public Action RefreshAction { get; set; } + public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true) { this.score = score; @@ -367,9 +370,15 @@ namespace osu.Game.Online.Leaderboards } } - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, null))) - }; + get + { + return (this.allowHighlight) ? null : new MenuItem[] + { + new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, () => Schedule(this.RefreshAction)))) + }; + } + } } } diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index b4889bfffc..2c5427993b 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -52,11 +52,7 @@ namespace osu.Game.Screens.Select new PopupDialogOkButton { Text = @"Yes. Please.", - Action = () => - { - Task.Run(() => scoreManager.Delete(score)) - .ContinueWith(_ => onCompletion); - } + Action = (() => scoreManager.Delete(score)) + onCompletion }, new PopupDialogCancelButton { diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index d609ee3bdc..ee360d1e57 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -15,6 +15,8 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; +using osu.Framework.Graphics.UserInterface; + namespace osu.Game.Screens.Select.Leaderboards { public class BeatmapLeaderboard : Leaderboard @@ -182,12 +184,14 @@ namespace osu.Game.Screens.Select.Leaderboards return req; } - protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index){ + protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) + { model.Beatmap = beatmap; - + return new LeaderboardScore(model, index, IsOnlineScope) { - Action = () => ScoreSelected?.Invoke(model) + Action = () => ScoreSelected?.Invoke(model), + RefreshAction = () => this.RefreshScores() }; } }