Cleanup dialog implementation

This commit is contained in:
Dan Balasescu 2022-06-08 18:10:41 +09:00
parent 3a90aa0b9b
commit f8594acb1d
1 changed files with 19 additions and 29 deletions

View File

@ -5,26 +5,17 @@
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;
}
[Resolved]
private SkinManager manager { get; set; }
public SkinDeleteDialog(Skin skin)
{
skin.SkinInfo.PerformRead(s =>
{
BodyText = s.Name;
BodyText = skin.SkinInfo.Value.Name;
Icon = FontAwesome.Regular.TrashAlt;
HeaderText = @"Confirm deletion of";
Buttons = new PopupDialogButton[]
@ -37,8 +28,8 @@ public SkinDeleteDialog(Skin skin)
if (manager == null)
return;
manager.Delete(s);
manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged();
manager.Delete(skin.SkinInfo.Value);
manager.CurrentSkinInfo.SetDefault();
},
},
new PopupDialogCancelButton
@ -46,7 +37,6 @@ public SkinDeleteDialog(Skin skin)
Text = @"Firetruck, I didn't mean to!",
},
};
});
}
}
}