2022-06-22 12:02:33 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-07-28 11:46:38 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2021-07-15 11:50:34 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2017-07-28 11:46:38 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2021-08-12 12:26:42 +08:00
|
|
|
|
using osu.Game.Localisation;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-07-28 11:46:38 +08:00
|
|
|
|
namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|
|
|
|
{
|
2022-06-22 06:00:03 +08:00
|
|
|
|
public partial class BeatmapSettings : SettingsSubsection
|
2017-07-28 11:46:38 +08:00
|
|
|
|
{
|
2022-09-16 20:08:25 +08:00
|
|
|
|
protected override LocalisableString Header => CommonStrings.Beatmaps;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-06-22 12:07:44 +08:00
|
|
|
|
private SettingsButton deleteBeatmapsButton = null!;
|
|
|
|
|
private SettingsButton deleteBeatmapVideosButton = null!;
|
|
|
|
|
private SettingsButton restoreButton = null!;
|
|
|
|
|
private SettingsButton undeleteButton = null!;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2023-01-10 02:17:40 +08:00
|
|
|
|
private void load(BeatmapManager beatmaps, IDialogOverlay? dialogOverlay)
|
2017-07-28 11:46:38 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
Add(deleteBeatmapsButton = new DangerousSettingsButton
|
|
|
|
|
{
|
|
|
|
|
Text = MaintenanceSettingsStrings.DeleteAllBeatmaps,
|
|
|
|
|
Action = () =>
|
2022-06-22 06:00:03 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
|
2022-06-22 06:00:03 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
deleteBeatmapsButton.Enabled.Value = false;
|
2022-06-24 20:25:23 +08:00
|
|
|
|
Task.Run(() => beatmaps.Delete()).ContinueWith(_ => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
|
2024-05-07 00:11:40 +08:00
|
|
|
|
}, DeleteConfirmationContentStrings.Beatmaps));
|
2022-06-22 12:13:04 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-02-28 12:09:38 +08:00
|
|
|
|
|
2022-06-22 12:13:04 +08:00
|
|
|
|
Add(deleteBeatmapVideosButton = new DangerousSettingsButton
|
|
|
|
|
{
|
|
|
|
|
Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos,
|
|
|
|
|
Action = () =>
|
|
|
|
|
{
|
2024-05-07 00:11:40 +08:00
|
|
|
|
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
|
2022-06-22 12:13:04 +08:00
|
|
|
|
{
|
|
|
|
|
deleteBeatmapVideosButton.Enabled.Value = false;
|
2022-06-24 20:25:23 +08:00
|
|
|
|
Task.Run(beatmaps.DeleteAllVideos).ContinueWith(_ => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true));
|
2024-05-07 00:11:40 +08:00
|
|
|
|
}, DeleteConfirmationContentStrings.BeatmapVideos));
|
2022-06-22 12:13:04 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
AddRange(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
restoreButton = new SettingsButton
|
2022-05-18 14:09:58 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
Text = MaintenanceSettingsStrings.RestoreAllHiddenDifficulties,
|
2017-09-01 17:26:01 +08:00
|
|
|
|
Action = () =>
|
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
restoreButton.Enabled.Value = false;
|
2022-06-24 20:25:23 +08:00
|
|
|
|
Task.Run(beatmaps.RestoreAll).ContinueWith(_ => Schedule(() => restoreButton.Enabled.Value = true));
|
2017-09-01 17:26:01 +08:00
|
|
|
|
}
|
2022-06-22 12:13:04 +08:00
|
|
|
|
},
|
|
|
|
|
undeleteButton = new SettingsButton
|
2017-11-30 17:58:32 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
Text = MaintenanceSettingsStrings.RestoreAllRecentlyDeletedBeatmaps,
|
|
|
|
|
Action = () =>
|
2017-11-30 17:58:32 +08:00
|
|
|
|
{
|
2022-06-22 12:13:04 +08:00
|
|
|
|
undeleteButton.Enabled.Value = false;
|
2022-06-24 20:25:23 +08:00
|
|
|
|
Task.Run(beatmaps.UndeleteAll).ContinueWith(_ => Schedule(() => undeleteButton.Enabled.Value = true));
|
2017-11-30 17:58:32 +08:00
|
|
|
|
}
|
2022-06-22 12:13:04 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2017-07-28 11:46:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|