1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 21:52:54 +08:00

Add item counts to import screen

This commit is contained in:
Dean Herbert 2022-05-16 20:13:34 +09:00
parent 6448c97929
commit 1666d13d26

View File

@ -4,6 +4,7 @@
#nullable enable #nullable enable
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Database; using osu.Game.Database;
@ -28,8 +29,8 @@ namespace osu.Game.Overlays.FirstRunSetup
[Resolved] [Resolved]
private OsuColour colours { get; set; } = null!; private OsuColour colours { get; set; } = null!;
[Resolved(canBeNull: true)] [Resolved]
private LegacyImportManager? legacyImportManager { get; set; } private LegacyImportManager legacyImportManager { get; set; } = null!;
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load() private void load()
@ -76,6 +77,11 @@ namespace osu.Game.Overlays.FirstRunSetup
Action = runImport Action = runImport
}, },
}; };
legacyImportManager.GetImportCount(StableContent.Beatmaps).ContinueWith(task => Schedule(() => checkboxBeatmaps.LabelText += $" ({task.GetResultSafely()} items)"));
legacyImportManager.GetImportCount(StableContent.Scores).ContinueWith(task => Schedule(() => checkboxScores.LabelText += $" ({task.GetResultSafely()} items)"));
legacyImportManager.GetImportCount(StableContent.Skins).ContinueWith(task => Schedule(() => checkboxSkins.LabelText += $" ({task.GetResultSafely()} items)"));
legacyImportManager.GetImportCount(StableContent.Collections).ContinueWith(task => Schedule(() => checkboxCollections.LabelText += $" ({task.GetResultSafely()} items)"));
} }
private void runImport() private void runImport()
@ -89,7 +95,7 @@ namespace osu.Game.Overlays.FirstRunSetup
if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins; if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins;
if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections; if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections;
legacyImportManager?.ImportFromStableAsync(importableContent) legacyImportManager.ImportFromStableAsync(importableContent)
.ContinueWith(t => Schedule(() => .ContinueWith(t => Schedule(() =>
{ {
if (t.IsCompletedSuccessfully) if (t.IsCompletedSuccessfully)