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

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. // 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. // See the LICENCE file in the repository root for full licence text.
@ -6,39 +7,51 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osu.Game.Online; using osu.Game.Online;
using osuTK; using osuTK;
namespace osu.Game.Overlays.FirstRunSetup namespace osu.Game.Overlays.FirstRunSetup
{ {
[Description("Bundled Beatmaps")] [Description("Obtaining Beatmaps")]
public class ScreenBundledBeatmaps : FirstRunSetupScreen 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 RoundedButton downloadTutorialButton = null!;
private ProgressBar progressBarTutorial; private ProgressBar progressBarTutorial = null!;
private BundledBeatmapDownloader tutorialDownloader; private BundledBeatmapDownloader tutorialDownloader = null!;
private BundledBeatmapDownloader bundledDownloader; private BundledBeatmapDownloader bundledDownloader = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours) 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[] Content.Children = new Drawable[]
{ {
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{ {
Colour = overlayColourProvider.Content1,
Text = 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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
@ -51,6 +64,13 @@ namespace osu.Game.Overlays.FirstRunSetup
Text = "Download tutorial", Text = "Download tutorial",
Action = downloadTutorial 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 downloadBundledButton = new RoundedButton
{ {
Size = buttonSize, Size = buttonSize,
@ -60,9 +80,34 @@ namespace osu.Game.Overlays.FirstRunSetup
Text = "Download beatmap selection", Text = "Download beatmap selection",
Action = downloadBundled 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) downloadTutorialButton.Add(progressBarTutorial = new ProgressBar(false)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -84,9 +129,6 @@ namespace osu.Game.Overlays.FirstRunSetup
private void downloadTutorial() private void downloadTutorial()
{ {
if (tutorialDownloader != null)
return;
tutorialDownloader = new BundledBeatmapDownloader(true); tutorialDownloader = new BundledBeatmapDownloader(true);
AddInternal(tutorialDownloader); AddInternal(tutorialDownloader);
@ -104,11 +146,6 @@ namespace osu.Game.Overlays.FirstRunSetup
private void downloadBundled() private void downloadBundled()
{ {
if (bundledDownloader != null)
return;
// downloadBundledButton.Enabled.Value = false;
bundledDownloader = new BundledBeatmapDownloader(false); bundledDownloader = new BundledBeatmapDownloader(false);
AddInternal(bundledDownloader); AddInternal(bundledDownloader);

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays
private readonly Type[] steps = private readonly Type[] steps =
{ {
typeof(ScreenWelcome), typeof(ScreenWelcome),
typeof(ScreenBundledBeatmaps), typeof(ScreenBeatmaps),
typeof(ScreenUIScale) typeof(ScreenUIScale)
}; };