mirror of
https://github.com/ppy/osu
synced 2024-12-10 17:12:57 +00:00
Cleanup dialog implementation
This commit is contained in:
parent
3a90aa0b9b
commit
f8594acb1d
@ -5,48 +5,38 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Database;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class SkinDeleteDialog : PopupDialog
|
public class SkinDeleteDialog : PopupDialog
|
||||||
{
|
{
|
||||||
private SkinManager manager;
|
[Resolved]
|
||||||
|
private SkinManager manager { get; set; }
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(SkinManager skinManager)
|
|
||||||
{
|
|
||||||
manager = skinManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkinDeleteDialog(Skin skin)
|
public SkinDeleteDialog(Skin skin)
|
||||||
{
|
{
|
||||||
skin.SkinInfo.PerformRead(s =>
|
BodyText = skin.SkinInfo.Value.Name;
|
||||||
|
Icon = FontAwesome.Regular.TrashAlt;
|
||||||
|
HeaderText = @"Confirm deletion of";
|
||||||
|
Buttons = new PopupDialogButton[]
|
||||||
{
|
{
|
||||||
BodyText = s.Name;
|
new PopupDialogDangerousButton
|
||||||
|
|
||||||
Icon = FontAwesome.Regular.TrashAlt;
|
|
||||||
HeaderText = @"Confirm deletion of";
|
|
||||||
Buttons = new PopupDialogButton[]
|
|
||||||
{
|
{
|
||||||
new PopupDialogDangerousButton
|
Text = @"Yes. Totally. Delete it.",
|
||||||
|
Action = () =>
|
||||||
{
|
{
|
||||||
Text = @"Yes. Totally. Delete it.",
|
if (manager == null)
|
||||||
Action = () =>
|
return;
|
||||||
{
|
|
||||||
if (manager == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
manager.Delete(s);
|
manager.Delete(skin.SkinInfo.Value);
|
||||||
manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged();
|
manager.CurrentSkinInfo.SetDefault();
|
||||||
},
|
|
||||||
},
|
},
|
||||||
new PopupDialogCancelButton
|
},
|
||||||
{
|
new PopupDialogCancelButton
|
||||||
Text = @"Firetruck, I didn't mean to!",
|
{
|
||||||
},
|
Text = @"Firetruck, I didn't mean to!",
|
||||||
};
|
},
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user