2019-12-19 11:22:42 +08:00
|
|
|
// 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 osu.Framework.Allocation;
|
|
|
|
using osu.Game.Overlays.Dialog;
|
|
|
|
using osu.Game.Scoring;
|
2019-12-19 13:04:10 +08:00
|
|
|
using System.Diagnostics;
|
2019-12-19 11:22:42 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2020-01-06 16:32:24 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2019-12-19 11:22:42 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select
|
|
|
|
{
|
|
|
|
public class LocalScoreDeleteDialog : PopupDialog
|
|
|
|
{
|
2020-01-06 16:32:24 +08:00
|
|
|
private readonly ScoreInfo score;
|
|
|
|
|
2020-01-04 03:34:26 +08:00
|
|
|
[Resolved]
|
|
|
|
private ScoreManager scoreManager { get; set; }
|
2019-12-19 11:22:42 +08:00
|
|
|
|
2020-01-06 16:32:24 +08:00
|
|
|
[Resolved]
|
|
|
|
private BeatmapManager beatmapManager { get; set; }
|
|
|
|
|
2019-12-19 11:26:35 +08:00
|
|
|
public LocalScoreDeleteDialog(ScoreInfo score)
|
2019-12-19 11:22:42 +08:00
|
|
|
{
|
2020-01-06 16:32:24 +08:00
|
|
|
this.score = score;
|
2019-12-19 13:04:10 +08:00
|
|
|
Debug.Assert(score != null);
|
2020-01-06 16:32:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-10-02 23:55:29 +08:00
|
|
|
BeatmapInfo beatmapInfo = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID);
|
|
|
|
Debug.Assert(beatmapInfo != null);
|
2019-12-19 11:22:42 +08:00
|
|
|
|
2020-02-03 23:11:36 +08:00
|
|
|
BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})";
|
2019-12-19 11:22:42 +08:00
|
|
|
|
2020-01-06 16:46:38 +08:00
|
|
|
Icon = FontAwesome.Regular.TrashAlt;
|
|
|
|
HeaderText = "Confirm deletion of local score";
|
2019-12-19 13:04:10 +08:00
|
|
|
Buttons = new PopupDialogButton[]
|
|
|
|
{
|
2022-04-05 01:22:53 +08:00
|
|
|
new PopupDialogDangerousButton
|
2019-12-19 13:04:10 +08:00
|
|
|
{
|
2020-01-06 16:46:38 +08:00
|
|
|
Text = "Yes. Please.",
|
2020-01-06 16:32:24 +08:00
|
|
|
Action = () => scoreManager?.Delete(score)
|
2019-12-19 13:04:10 +08:00
|
|
|
},
|
|
|
|
new PopupDialogCancelButton
|
2019-12-19 11:22:42 +08:00
|
|
|
{
|
2020-01-06 16:46:38 +08:00
|
|
|
Text = "No, I'm still attached.",
|
2019-12-19 13:04:10 +08:00
|
|
|
},
|
|
|
|
};
|
2019-12-19 11:22:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|