mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:57:52 +08:00
Add import from stable screen
This commit is contained in:
parent
ef5b2233d7
commit
4412fec41a
@ -74,6 +74,16 @@ We recommend you give the new defaults a try, but if you'd like to have things f
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults");
|
public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Welcome"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ImportTitle => new TranslatableString(getKey(@"import_title"), @"Import");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Import content from stable"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ImportContentFromStable => new TranslatableString(getKey(@"import_content_from_stable"), @"Import content from osu!(stable)");
|
||||||
|
|
||||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
public class ScreenBeatmaps : FirstRunSetupScreen
|
public class ScreenBeatmaps : FirstRunSetupScreen
|
||||||
{
|
{
|
||||||
private ProgressRoundedButton downloadBundledButton = null!;
|
private ProgressRoundedButton downloadBundledButton = null!;
|
||||||
private ProgressRoundedButton importBeatmapsButton = null!;
|
|
||||||
private ProgressRoundedButton downloadTutorialButton = null!;
|
private ProgressRoundedButton downloadTutorialButton = null!;
|
||||||
|
|
||||||
private OsuTextFlowContainer currentlyLoadedBeatmaps = null!;
|
private OsuTextFlowContainer currentlyLoadedBeatmaps = null!;
|
||||||
@ -41,8 +40,8 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
|
|
||||||
private IDisposable? beatmapSubscription;
|
private IDisposable? beatmapSubscription;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LegacyImportManager? legacyImportManager)
|
private void load()
|
||||||
{
|
{
|
||||||
Vector2 buttonSize = new Vector2(400, 50);
|
Vector2 buttonSize = new Vector2(400, 50);
|
||||||
|
|
||||||
@ -104,35 +103,6 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
Action = downloadBundled
|
Action = downloadBundled
|
||||||
},
|
},
|
||||||
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
|
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
|
||||||
{
|
|
||||||
Colour = OverlayColourProvider.Content1,
|
|
||||||
Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.",
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y
|
|
||||||
},
|
|
||||||
importBeatmapsButton = new ProgressRoundedButton
|
|
||||||
{
|
|
||||||
Size = buttonSize,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
BackgroundColour = colours.Blue3,
|
|
||||||
Text = MaintenanceSettingsStrings.ImportBeatmapsFromStable,
|
|
||||||
Action = () =>
|
|
||||||
{
|
|
||||||
importBeatmapsButton.Enabled.Value = false;
|
|
||||||
legacyImportManager?.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() =>
|
|
||||||
{
|
|
||||||
if (t.IsCompletedSuccessfully)
|
|
||||||
importBeatmapsButton.Complete();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
importBeatmapsButton.Enabled.Value = true;
|
|
||||||
importBeatmapsButton.Abort();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
|
|
||||||
{
|
{
|
||||||
Colour = OverlayColourProvider.Content1,
|
Colour = OverlayColourProvider.Content1,
|
||||||
Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps,
|
Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps,
|
||||||
|
105
osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs
Normal file
105
osu.Game/Overlays/FirstRunSetup/ScreenImportFromStable.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.FirstRunSetup
|
||||||
|
{
|
||||||
|
[LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.ImportTitle))]
|
||||||
|
public class ScreenImportFromStable : FirstRunSetupScreen
|
||||||
|
{
|
||||||
|
private ProgressRoundedButton importButton = null!;
|
||||||
|
|
||||||
|
private SettingsCheckbox checkboxSkins = null!;
|
||||||
|
private SettingsCheckbox checkboxBeatmaps = null!;
|
||||||
|
private SettingsCheckbox checkboxScores = null!;
|
||||||
|
private SettingsCheckbox checkboxCollections = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private LegacyImportManager? legacyImportManager { get; set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Vector2 buttonSize = new Vector2(400, 50);
|
||||||
|
|
||||||
|
Content.Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
|
||||||
|
{
|
||||||
|
Colour = OverlayColourProvider.Content1,
|
||||||
|
Text =
|
||||||
|
"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation.",
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y
|
||||||
|
},
|
||||||
|
checkboxBeatmaps = new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Beatmaps",
|
||||||
|
Current = { Value = true }
|
||||||
|
},
|
||||||
|
checkboxScores = new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Scores",
|
||||||
|
Current = { Value = true }
|
||||||
|
},
|
||||||
|
checkboxSkins = new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Skins",
|
||||||
|
Current = { Value = true }
|
||||||
|
},
|
||||||
|
checkboxCollections = new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Collections",
|
||||||
|
Current = { Value = true }
|
||||||
|
},
|
||||||
|
importButton = new ProgressRoundedButton
|
||||||
|
{
|
||||||
|
Size = buttonSize,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
BackgroundColour = colours.Blue3,
|
||||||
|
Text = FirstRunSetupOverlayStrings.ImportContentFromStable,
|
||||||
|
Action = runImport
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runImport()
|
||||||
|
{
|
||||||
|
importButton.Enabled.Value = false;
|
||||||
|
|
||||||
|
StableContent importableContent = 0;
|
||||||
|
|
||||||
|
if (checkboxBeatmaps.Current.Value) importableContent |= StableContent.Beatmaps;
|
||||||
|
if (checkboxScores.Current.Value) importableContent |= StableContent.Scores;
|
||||||
|
if (checkboxSkins.Current.Value) importableContent |= StableContent.Skins;
|
||||||
|
if (checkboxCollections.Current.Value) importableContent |= StableContent.Collections;
|
||||||
|
|
||||||
|
legacyImportManager?.ImportFromStableAsync(importableContent)
|
||||||
|
.ContinueWith(t => Schedule(() =>
|
||||||
|
{
|
||||||
|
if (t.IsCompletedSuccessfully)
|
||||||
|
importButton.Complete();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
importButton.Enabled.Value = true;
|
||||||
|
importButton.Abort();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -17,6 +18,7 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
@ -55,13 +57,7 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen;
|
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen;
|
||||||
|
|
||||||
private readonly Type[] steps =
|
private readonly List<Type> steps = new List<Type>();
|
||||||
{
|
|
||||||
typeof(ScreenWelcome),
|
|
||||||
typeof(ScreenBeatmaps),
|
|
||||||
typeof(ScreenUIScale),
|
|
||||||
typeof(ScreenBehaviour),
|
|
||||||
};
|
|
||||||
|
|
||||||
private Container screenContent = null!;
|
private Container screenContent = null!;
|
||||||
|
|
||||||
@ -77,9 +73,16 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, LegacyImportManager? legacyImportManager)
|
||||||
{
|
{
|
||||||
|
steps.Add(typeof(ScreenWelcome));
|
||||||
|
steps.Add(typeof(ScreenBeatmaps));
|
||||||
|
if (legacyImportManager?.SupportsImportFromStable == true)
|
||||||
|
steps.Add(typeof(ScreenImportFromStable));
|
||||||
|
steps.Add(typeof(ScreenUIScale));
|
||||||
|
steps.Add(typeof(ScreenBehaviour));
|
||||||
|
|
||||||
Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
|
Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
|
||||||
Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;
|
Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;
|
||||||
|
|
||||||
@ -313,7 +316,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
currentStepIndex++;
|
currentStepIndex++;
|
||||||
|
|
||||||
if (currentStepIndex < steps.Length)
|
if (currentStepIndex < steps.Count)
|
||||||
{
|
{
|
||||||
var nextScreen = (Screen)Activator.CreateInstance(steps[currentStepIndex.Value]);
|
var nextScreen = (Screen)Activator.CreateInstance(steps[currentStepIndex.Value]);
|
||||||
|
|
||||||
@ -345,7 +348,7 @@ namespace osu.Game.Overlays
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bool isFirstStep = currentStepIndex == 0;
|
bool isFirstStep = currentStepIndex == 0;
|
||||||
bool isLastStep = currentStepIndex == steps.Length - 1;
|
bool isLastStep = currentStepIndex == steps.Count - 1;
|
||||||
|
|
||||||
if (isFirstStep)
|
if (isFirstStep)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user