Rename screen, add tests and add stable import step

This commit is contained in:
Dean Herbert 2022-04-28 16:09:00 +09:00
parent d056465742
commit 3c0bdcaf38
3 changed files with 84 additions and 23 deletions

View File

@ -0,0 +1,24 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Overlays;
using osu.Game.Overlays.FirstRunSetup;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneFirstRunScreenBundledBeatmaps : OsuManualInputManagerTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneFirstRunScreenBundledBeatmaps()
{
AddStep("load screen", () =>
{
Child = new ScreenStack(new ScreenBeatmaps());
});
}
}
}

View File

@ -1,3 +1,4 @@
#nullable enable
// 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.
@ -6,39 +7,51 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osu.Game.Online;
using osuTK;
namespace osu.Game.Overlays.FirstRunSetup
{
[Description("Bundled Beatmaps")]
public class ScreenBundledBeatmaps : FirstRunSetupScreen
[Description("Obtaining Beatmaps")]
public class ScreenBeatmaps : FirstRunSetupScreen
{
private RoundedButton downloadBundledButton;
private RoundedButton downloadBundledButton = null!;
private RoundedButton importBeatmapsButton = null!;
private ProgressBar progressBarBundled;
private ProgressBar progressBarBundled = null!;
private RoundedButton downloadTutorialButton;
private ProgressBar progressBarTutorial;
private RoundedButton downloadTutorialButton = null!;
private ProgressBar progressBarTutorial = null!;
private BundledBeatmapDownloader tutorialDownloader;
private BundledBeatmapDownloader bundledDownloader;
private BundledBeatmapDownloader tutorialDownloader = null!;
private BundledBeatmapDownloader bundledDownloader = null!;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, OverlayColourProvider overlayColourProvider, LegacyImportManager? legacyImportManager)
{
Vector2 buttonSize = new Vector2(500, 80);
Vector2 buttonSize = new Vector2(500, 60);
Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{
Colour = overlayColourProvider.Content1,
Text =
"osu! doesn't come with any beatmaps pre-loaded. To get started, we have some recommended beatmaps. You can obtain more beatmaps from the main menu \"browse\" button at any time.",
"\"Beatmaps\" are what we call playable levels in osu!.\n\nosu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{
Colour = overlayColourProvider.Content1,
Text =
"If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
@ -51,6 +64,13 @@ private void load(OsuColour colours)
Text = "Download tutorial",
Action = downloadTutorial
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{
Colour = overlayColourProvider.Content1,
Text = "To get you started, we have some recommended beatmaps.",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
downloadBundledButton = new RoundedButton
{
Size = buttonSize,
@ -60,9 +80,34 @@ private void load(OsuColour colours)
Text = "Download beatmap selection",
Action = downloadBundled
},
// TODO: add stable import button if a stable install is detected.
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{
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 RoundedButton
{
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(() => importBeatmapsButton.Enabled.Value = true));
}
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{
Colour = overlayColourProvider.Content1,
Text = "You can also obtain more beatmaps from the main menu \"browse\" button at any time.",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
};
downloadTutorialButton.Add(progressBarTutorial = new ProgressBar(false)
{
RelativeSizeAxes = Axes.Both,
@ -84,9 +129,6 @@ private void load(OsuColour colours)
private void downloadTutorial()
{
if (tutorialDownloader != null)
return;
tutorialDownloader = new BundledBeatmapDownloader(true);
AddInternal(tutorialDownloader);
@ -104,11 +146,6 @@ private void downloadTutorial()
private void downloadBundled()
{
if (bundledDownloader != null)
return;
// downloadBundledButton.Enabled.Value = false;
bundledDownloader = new BundledBeatmapDownloader(false);
AddInternal(bundledDownloader);

View File

@ -60,7 +60,7 @@ public class FirstRunSetupOverlay : ShearedOverlayContainer
private readonly Type[] steps =
{
typeof(ScreenWelcome),
typeof(ScreenBundledBeatmaps),
typeof(ScreenBeatmaps),
typeof(ScreenUIScale)
};