osu/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2019-01-04 19:13:32 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using System;
using System.Linq;
namespace osu.Game.Screens.Select
{
2019-01-04 19:32:52 +00:00
public class BeatmapClearScoresDialog : PopupDialog
2019-01-04 19:13:32 +00:00
{
private ScoreManager manager;
[BackgroundDependencyLoader]
2019-01-06 12:38:43 +00:00
private void load(ScoreManager scoreManager)
2019-01-04 19:13:32 +00:00
{
2019-01-06 12:38:43 +00:00
manager = scoreManager;
2019-01-04 19:13:32 +00:00
}
2019-01-08 16:57:03 +00:00
public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action refresh)
2019-01-04 19:13:32 +00:00
{
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
Icon = FontAwesome.fa_eraser;
2019-03-01 00:49:36 +00:00
HeaderText = @"Clearing all local scores. Are you sure?";
2019-01-04 19:13:32 +00:00
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Please.",
Action = () =>
{
2019-01-08 16:57:03 +00:00
manager.Delete(manager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList());
2019-01-04 19:13:32 +00:00
refresh();
}
},
new PopupDialogCancelButton
{
Text = @"No, I'm still attached.",
},
};
}
}
}