mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Leaderboard should not change the model
This commit is contained in:
parent
4a7f5f98df
commit
61c269b17b
@ -186,15 +186,10 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
return req;
|
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;
|
Action = () => ScoreSelected?.Invoke(model)
|
||||||
|
};
|
||||||
return new LeaderboardScore(model, index, IsOnlineScope)
|
|
||||||
{
|
|
||||||
Action = () => ScoreSelected?.Invoke(model)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
|
@ -6,21 +6,35 @@ using osu.Game.Overlays.Dialog;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class LocalScoreDeleteDialog : PopupDialog
|
public class LocalScoreDeleteDialog : PopupDialog
|
||||||
{
|
{
|
||||||
|
private readonly ScoreInfo score;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; }
|
private ScoreManager scoreManager { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
public LocalScoreDeleteDialog(ScoreInfo score)
|
public LocalScoreDeleteDialog(ScoreInfo score)
|
||||||
{
|
{
|
||||||
|
this.score = score;
|
||||||
Debug.Assert(score != null);
|
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);
|
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;
|
Icon = FontAwesome.Solid.Eraser;
|
||||||
HeaderText = @"Deleting this local score. Are you sure?";
|
HeaderText = @"Deleting this local score. Are you sure?";
|
||||||
Buttons = new PopupDialogButton[]
|
Buttons = new PopupDialogButton[]
|
||||||
@ -28,7 +42,7 @@ namespace osu.Game.Screens.Select
|
|||||||
new PopupDialogOkButton
|
new PopupDialogOkButton
|
||||||
{
|
{
|
||||||
Text = @"Yes. Please.",
|
Text = @"Yes. Please.",
|
||||||
Action = () => scoreManager.Delete(score)
|
Action = () => scoreManager?.Delete(score)
|
||||||
},
|
},
|
||||||
new PopupDialogCancelButton
|
new PopupDialogCancelButton
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user