1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Leaderboard should not change the model

This commit is contained in:
smoogipoo 2020-01-06 17:32:24 +09:00
parent 4a7f5f98df
commit 61c269b17b
2 changed files with 19 additions and 10 deletions

View File

@ -186,15 +186,10 @@ namespace osu.Game.Screens.Select.Leaderboards
return req;
}
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index)
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
{
model.Beatmap = beatmap;
return new LeaderboardScore(model, index, IsOnlineScope)
{
Action = () => ScoreSelected?.Invoke(model)
};
}
Action = () => ScoreSelected?.Invoke(model)
};
protected override void Dispose(bool isDisposing)
{

View File

@ -6,21 +6,35 @@ using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using System.Diagnostics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
namespace osu.Game.Screens.Select
{
public class LocalScoreDeleteDialog : PopupDialog
{
private readonly ScoreInfo score;
[Resolved]
private ScoreManager scoreManager { get; set; }
[Resolved]
private BeatmapManager beatmapManager { get; set; }
public LocalScoreDeleteDialog(ScoreInfo score)
{
this.score = score;
Debug.Assert(score != null);
}
[BackgroundDependencyLoader]
private void load()
{
BeatmapInfo beatmap = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID);
Debug.Assert(beatmap != null);
string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy);
BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {score.Beatmap}";
BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {beatmap}";
Icon = FontAwesome.Solid.Eraser;
HeaderText = @"Deleting this local score. Are you sure?";
Buttons = new PopupDialogButton[]
@ -28,7 +42,7 @@ namespace osu.Game.Screens.Select
new PopupDialogOkButton
{
Text = @"Yes. Please.",
Action = () => scoreManager.Delete(score)
Action = () => scoreManager?.Delete(score)
},
new PopupDialogCancelButton
{