1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 00:47:24 +08:00
osu-lazer/osu.Game/Screens/Select/BeatmapDeleteDialog.cs

49 lines
1.5 KiB
C#
Raw Normal View History

2017-02-28 11:19:28 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-03-07 09:59:19 +08:00
using System;
using osu.Framework.Allocation;
2017-02-28 11:19:28 +08:00
using osu.Game.Beatmaps;
using osu.Game.Database;
2017-02-28 11:19:28 +08:00
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
2017-03-03 09:28:05 +08:00
namespace osu.Game.Screens.Select
2017-02-28 11:19:28 +08:00
{
public class BeatmapDeleteDialog : PopupDialog
{
private BeatmapDatabase database;
[BackgroundDependencyLoader]
private void load(BeatmapDatabase beatmapDatabase)
{
database = beatmapDatabase;
}
2017-02-28 11:19:28 +08:00
public BeatmapDeleteDialog(WorkingBeatmap beatmap)
2017-02-28 11:19:28 +08:00
{
2017-03-07 09:59:19 +08:00
if (beatmap == null) throw new ArgumentNullException(nameof(beatmap));
2017-02-28 11:19:28 +08:00
Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of";
2017-03-07 09:59:19 +08:00
BodyText = $@"{beatmap.Beatmap?.Metadata?.Artist} - {beatmap.Beatmap?.Metadata?.Title}";
2017-02-28 11:19:28 +08:00
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Totally. Delete it.",
Action = () =>
{
beatmap.Dispose();
database.Delete(beatmap.BeatmapSetInfo);
2017-02-28 11:19:28 +08:00
},
},
new PopupDialogCancelButton
{
Text = @"Firetruck, I didn't mean to!",
},
};
}
}
}