1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 16:07:25 +08:00

Merge pull request #17996 from peppy/first-run-header

Add header text to first run setup screens
This commit is contained in:
Bartłomiej Dach 2022-04-28 22:56:28 +02:00 committed by GitHub
commit 26ecf60f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 25 deletions

View File

@ -1,13 +1,18 @@
// 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 TestSceneFirstRunScreenUIScale : OsuManualInputManagerTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneFirstRunScreenUIScale()
{
AddStep("load screen", () =>

View File

@ -1,10 +1,14 @@
// 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.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Overlays.FirstRunSetup
@ -15,19 +19,33 @@ namespace osu.Game.Overlays.FirstRunSetup
protected FillFlowContainer Content { get; private set; }
protected FirstRunSetupScreen()
[BackgroundDependencyLoader]
private void load(OverlayColourProvider overlayColourProvider)
{
const float header_size = 40;
const float spacing = 20;
InternalChildren = new Drawable[]
{
new OsuScrollContainer(Direction.Vertical)
{
RelativeSizeAxes = Axes.Both,
Child = Content = new FillFlowContainer
Children = new Drawable[]
{
Spacing = new Vector2(20),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
new OsuSpriteText
{
Text = this.GetLocalisableDescription(),
Font = OsuFont.Default.With(size: header_size),
Colour = overlayColourProvider.Light1,
},
Content = new FillFlowContainer
{
Y = header_size + spacing,
Spacing = new Vector2(spacing),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
}
},
}
};

View File

@ -27,6 +27,7 @@ using osuTK;
namespace osu.Game.Overlays.FirstRunSetup
{
[LocalisableDescription(typeof(GraphicsSettingsStrings), nameof(GraphicsSettingsStrings.UIScaling))]
public class ScreenUIScale : FirstRunSetupScreen
{
[BackgroundDependencyLoader]

View File

@ -1,16 +1,20 @@
// 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.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Localisation;
namespace osu.Game.Overlays.FirstRunSetup
{
[LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.WelcomeTitle))]
public class ScreenWelcome : FirstRunSetupScreen
{
public ScreenWelcome()
[BackgroundDependencyLoader]
private void load()
{
Content.Children = new Drawable[]
{

View File

@ -7,6 +7,7 @@ using System;
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -56,10 +57,10 @@ namespace osu.Game.Overlays
/// </summary>
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen;
private readonly FirstRunStep[] steps =
private readonly Type[] steps =
{
new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.WelcomeTitle),
new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling),
typeof(ScreenWelcome),
typeof(ScreenUIScale)
};
private Container stackContainer = null!;
@ -286,7 +287,7 @@ namespace osu.Game.Overlays
if (currentStepIndex < steps.Length)
{
stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType));
stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value]));
}
else
{
@ -317,23 +318,11 @@ namespace osu.Game.Overlays
}
else
{
BackButton.Text = LocalisableString.Interpolate($@"{CommonStrings.Back} ({steps[currentStepIndex.Value - 1].Description})");
BackButton.Text = LocalisableString.Interpolate($@"{CommonStrings.Back} ({steps[currentStepIndex.Value - 1].GetLocalisableDescription()})");
NextButton.Text = isLastStep
? CommonStrings.Finish
: LocalisableString.Interpolate($@"{CommonStrings.Next} ({steps[currentStepIndex.Value + 1].Description})");
}
}
private class FirstRunStep
{
public readonly Type ScreenType;
public readonly LocalisableString Description;
public FirstRunStep(Type screenType, LocalisableString description)
{
ScreenType = screenType;
Description = description;
: LocalisableString.Interpolate($@"{CommonStrings.Next} ({steps[currentStepIndex.Value + 1].GetLocalisableDescription()})");
}
}
}