mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Add header text to first run setup screens
This commit is contained in:
parent
9d198ad6bb
commit
01fdb771ee
@ -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),
|
||||
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,
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
@ -27,6 +27,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.FirstRunSetup
|
||||
{
|
||||
[LocalisableDescription(typeof(GraphicsSettingsStrings), nameof(GraphicsSettingsStrings.UIScaling))]
|
||||
public class ScreenUIScale : FirstRunSetupScreen
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -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[]
|
||||
{
|
||||
|
@ -7,12 +7,12 @@ 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;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -56,10 +56,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 +286,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
|
||||
{
|
||||
@ -307,21 +307,9 @@ namespace osu.Game.Overlays
|
||||
if (currentStepIndex != null)
|
||||
{
|
||||
NextButton.Text = currentStepIndex + 1 < steps.Length
|
||||
? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description)
|
||||
? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].GetLocalisableDescription())
|
||||
: CommonStrings.Finish;
|
||||
}
|
||||
}
|
||||
|
||||
private class FirstRunStep
|
||||
{
|
||||
public readonly Type ScreenType;
|
||||
public readonly LocalisableString Description;
|
||||
|
||||
public FirstRunStep(Type screenType, LocalisableString description)
|
||||
{
|
||||
ScreenType = screenType;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user