1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +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.
// 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;
@ -370,8 +369,6 @@ namespace osu.Game.Online.Leaderboards
private void deleteLocalScore(ScoreInfo score)
{
if (score == null || score.ID <= 0) return;
dialogOverlay?.Push(new LocalScoreDeleteDialog(score));
}
@ -379,9 +376,9 @@ namespace osu.Game.Online.Leaderboards
{
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)
{
if (score == null)
return;
Schedule(() => this.RefreshScores());
Schedule(RefreshScores);
}
}
}

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using System;
using System.Threading.Tasks;
using System.Diagnostics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Logging;
@ -17,13 +17,13 @@ namespace osu.Game.Screens.Select
public LocalScoreDeleteDialog(ScoreInfo score)
{
try
{
string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy);
Debug.Assert(score != null);
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}";
Icon = FontAwesome.Solid.Eraser;
HeaderText = @"Clearing this local score. Are you sure?";
HeaderText = @"Deleting this local score. Are you sure?";
Buttons = new PopupDialogButton[]
{
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]
private void load(ScoreManager scoreManager)