1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 04:22:54 +08:00
osu-lazer/osu.Game/Overlays/Settings/Sections/Maintenance/SkinSettings.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.9 KiB
C#
Raw Normal View History

2022-06-22 12:02:33 +08:00
// 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 System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Database;
using osu.Game.Localisation;
using osu.Game.Skinning;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public partial class SkinSettings : SettingsSubsection
{
2022-09-16 20:08:25 +08:00
protected override LocalisableString Header => CommonStrings.Skins;
2022-06-22 12:07:44 +08:00
private SettingsButton importSkinsButton = null!;
private SettingsButton deleteSkinsButton = null!;
[BackgroundDependencyLoader]
private void load(SkinManager skins, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay)
{
if (legacyImportManager?.SupportsImportFromStable == true)
{
Add(importSkinsButton = new SettingsButton
{
Text = MaintenanceSettingsStrings.ImportSkinsFromStable,
Action = () =>
{
importSkinsButton.Enabled.Value = false;
2022-06-24 20:25:23 +08:00
legacyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(_ => Schedule(() => importSkinsButton.Enabled.Value = true));
}
});
}
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));
}));
}
});
}
}
}