mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Close #5820 (Ability to delete a single skin)
This commit is contained in:
48
osu.Game/Screens/Select/SkinDeleteDialog.cs
Normal file
48
osu.Game/Screens/Select/SkinDeleteDialog.cs
Normal file
@ -0,0 +1,48 @@
|
||||
// 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.Framework.Graphics.Sprites;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class SkinDeleteDialog : PopupDialog
|
||||
{
|
||||
private SkinManager manager;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(SkinManager skinManager)
|
||||
{
|
||||
manager = skinManager;
|
||||
}
|
||||
|
||||
public SkinDeleteDialog(Skin skin)
|
||||
{
|
||||
skin.SkinInfo.PerformRead(s =>
|
||||
{
|
||||
BodyText = s.Name;
|
||||
|
||||
Icon = FontAwesome.Regular.TrashAlt;
|
||||
HeaderText = @"Confirm deletion of";
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogDangerousButton
|
||||
{
|
||||
Text = @"Yes. Totally. Delete it.",
|
||||
Action = () => {
|
||||
manager.Delete(s);
|
||||
manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged();
|
||||
},
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Firetruck, I didn't mean to!",
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user