1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 10:52:55 +08:00

Removed unnecessary code for deleting individual local score.

This commit is contained in:
Willy Tu 2019-12-18 21:04:10 -08:00
parent 9ed2dbce8c
commit 27163a5133
3 changed files with 20 additions and 41 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -370,8 +369,6 @@ namespace osu.Game.Online.Leaderboards
private void deleteLocalScore(ScoreInfo score) private void deleteLocalScore(ScoreInfo score)
{ {
if (score == null || score.ID <= 0) return;
dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); dialogOverlay?.Push(new LocalScoreDeleteDialog(score));
} }
@ -379,9 +376,9 @@ namespace osu.Game.Online.Leaderboards
{ {
get get
{ {
return (this.allowHighlight) ? null : new MenuItem[] return (allowHighlight) ? null : new MenuItem[]
{ {
new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(this.score)) new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score)),
}; };
} }
} }

View File

@ -206,10 +206,7 @@ namespace osu.Game.Screens.Select.Leaderboards
private void deleteLocalScore(ScoreInfo score) private void deleteLocalScore(ScoreInfo score)
{ {
if (score == null) Schedule(RefreshScores);
return;
Schedule(() => this.RefreshScores());
} }
} }
} }

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Game.Overlays.Dialog; using osu.Game.Overlays.Dialog;
using osu.Game.Scoring; using osu.Game.Scoring;
using System; using System;
using System.Threading.Tasks; using System.Diagnostics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Logging; using osu.Framework.Logging;
@ -17,13 +17,13 @@ namespace osu.Game.Screens.Select
public LocalScoreDeleteDialog(ScoreInfo score) public LocalScoreDeleteDialog(ScoreInfo score)
{ {
try Debug.Assert(score != null);
{
string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy);
BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}";
Icon = FontAwesome.Solid.Eraser; Icon = FontAwesome.Solid.Eraser;
HeaderText = @"Clearing this local score. Are you sure?"; HeaderText = @"Deleting this local score. Are you sure?";
Buttons = new PopupDialogButton[] Buttons = new PopupDialogButton[]
{ {
new PopupDialogOkButton new PopupDialogOkButton
@ -37,21 +37,6 @@ namespace osu.Game.Screens.Select
}, },
}; };
} }
catch (Exception e)
{
Logger.Error(e, "ScoreInfo cannot be null!");
HeaderText = $@"ScoreInfo cannot be null!";
Icon = FontAwesome.Solid.Ambulance;
Buttons = new PopupDialogButton[]
{
new PopupDialogCancelButton
{
Text = @"OK, thanks.",
},
};
}
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ScoreManager scoreManager) private void load(ScoreManager scoreManager)