mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Implement collection import
This commit is contained in:
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
@ -19,6 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
private TriangleButton importBeatmapsButton;
|
||||
private TriangleButton importScoresButton;
|
||||
private TriangleButton importSkinsButton;
|
||||
private TriangleButton importCollectionsButton;
|
||||
private TriangleButton deleteBeatmapsButton;
|
||||
private TriangleButton deleteScoresButton;
|
||||
private TriangleButton deleteSkinsButton;
|
||||
@ -26,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
private TriangleButton undeleteButton;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, DialogOverlay dialogOverlay)
|
||||
private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, CollectionManager collections, DialogOverlay dialogOverlay)
|
||||
{
|
||||
if (beatmaps.SupportsImportFromStable)
|
||||
{
|
||||
@ -93,20 +95,43 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
});
|
||||
}
|
||||
|
||||
AddRange(new Drawable[]
|
||||
Add(deleteSkinsButton = new DangerousSettingsButton
|
||||
{
|
||||
deleteSkinsButton = new DangerousSettingsButton
|
||||
Text = "Delete ALL skins",
|
||||
Action = () =>
|
||||
{
|
||||
Text = "Delete ALL skins",
|
||||
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
|
||||
{
|
||||
deleteSkinsButton.Enabled.Value = false;
|
||||
Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
if (collections.SupportsImportFromStable)
|
||||
{
|
||||
Add(importCollectionsButton = new SettingsButton
|
||||
{
|
||||
Text = "Import collections from stable",
|
||||
Action = () =>
|
||||
{
|
||||
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
|
||||
{
|
||||
deleteSkinsButton.Enabled.Value = false;
|
||||
Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
|
||||
}));
|
||||
importCollectionsButton.Enabled.Value = false;
|
||||
collections.ImportFromStableAsync().ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Add(new DangerousSettingsButton
|
||||
{
|
||||
Text = "Delete ALL collections",
|
||||
Action = () =>
|
||||
{
|
||||
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => collections.Collections.Clear()));
|
||||
}
|
||||
});
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
restoreButton = new SettingsButton
|
||||
{
|
||||
Text = "Restore all hidden difficulties",
|
||||
|
Reference in New Issue
Block a user