2022-06-22 12:02:33 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2022-06-22 06:00:03 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
|
using osu.Game.Localisation;
|
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class SkinSettings : SettingsSubsection
|
2022-06-22 06:00:03 +08:00
|
|
|
|
{
|
2022-09-16 20:08:25 +08:00
|
|
|
|
protected override LocalisableString Header => CommonStrings.Skins;
|
2022-06-22 06:00:03 +08:00
|
|
|
|
|
2022-06-22 12:07:44 +08:00
|
|
|
|
private SettingsButton deleteSkinsButton = null!;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2023-01-10 02:17:40 +08:00
|
|
|
|
private void load(SkinManager skins, IDialogOverlay? dialogOverlay)
|
2022-06-22 06:00:03 +08:00
|
|
|
|
{
|
|
|
|
|
Add(deleteSkinsButton = new DangerousSettingsButton
|
|
|
|
|
{
|
|
|
|
|
Text = MaintenanceSettingsStrings.DeleteAllSkins,
|
|
|
|
|
Action = () =>
|
|
|
|
|
{
|
|
|
|
|
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
|
|
|
|
|
{
|
|
|
|
|
deleteSkinsButton.Enabled.Value = false;
|
2022-06-24 20:25:23 +08:00
|
|
|
|
Task.Run(() => skins.Delete()).ContinueWith(_ => Schedule(() => deleteSkinsButton.Enabled.Value = true));
|
2022-06-22 06:00:03 +08:00
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|