1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 06:42:54 +08:00
osu-lazer/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs

43 lines
1.4 KiB
C#
Raw Normal View History

2019-03-01 09:52:53 +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.
2019-01-05 03:13:32 +08:00
2021-12-13 18:01:20 +08:00
using System;
using System.Threading.Tasks;
2019-01-05 03:13:32 +08:00
using osu.Framework.Allocation;
2021-12-13 18:01:20 +08:00
using osu.Framework.Graphics.Sprites;
2019-01-05 03:13:32 +08:00
using osu.Game.Beatmaps;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select
{
2019-01-05 03:32:52 +08:00
public class BeatmapClearScoresDialog : PopupDialog
2019-01-05 03:13:32 +08:00
{
[Resolved]
private ScoreManager scoreManager { get; set; }
2019-01-05 03:13:32 +08:00
2021-10-02 23:55:29 +08:00
public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action onCompletion)
2019-01-05 03:13:32 +08:00
{
2022-01-12 22:42:12 +08:00
BodyText = beatmapInfo.GetDisplayTitle();
2019-04-02 18:55:24 +08:00
Icon = FontAwesome.Solid.Eraser;
2019-03-01 08:49:36 +08:00
HeaderText = @"Clearing all local scores. Are you sure?";
2019-01-05 03:13:32 +08:00
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Please.",
Action = () =>
{
2021-12-13 18:01:20 +08:00
Task.Run(() => scoreManager.Delete(s => !s.DeletePending && s.BeatmapInfo.ID == beatmapInfo.ID))
.ContinueWith(_ => onCompletion);
2019-01-05 03:13:32 +08:00
}
},
new PopupDialogCancelButton
{
Text = @"No, I'm still attached.",
},
};
}
}
}