1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:02:55 +08:00

Add first-run "behaviour" screen to allow users a choice of more familiar UX

This commit is contained in:
Dean Herbert 2022-04-22 18:05:52 +09:00
parent e0b9ab022d
commit 1caee38768
4 changed files with 151 additions and 1 deletions

View File

@ -0,0 +1,19 @@
// 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.Screens;
using osu.Game.Overlays.FirstRunSetup;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneFirstRunScreenBehaviour : OsuManualInputManagerTestScene
{
public TestSceneFirstRunScreenBehaviour()
{
AddStep("load screen", () =>
{
Child = new ScreenStack(new ScreenBehaviour());
});
}
}
}

View File

@ -17,7 +17,8 @@ namespace osu.Game.Localisation
/// <summary>
/// "Click to resume first-run setup at any point"
/// </summary>
public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point");
public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint =>
new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point");
/// <summary>
/// "First-run setup"
@ -53,6 +54,31 @@ osu! is a very configurable game, and diving straight into the settings can some
/// </summary>
public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription);
/// <summary>
/// "Behaviour"
/// </summary>
public static LocalisableString Behaviour => new TranslatableString(getKey(@"behaviour"), @"Behaviour");
/// <summary>
/// "Some new defaults for game behaviours have been implemented, with the aim of improving the game experience and making it more accessible to everyone.
///
/// We recommend you give the new defaults a try, but if you&#39;d like to have things feel more like classic versions of osu!, you can easily apply some sane defaults below."
/// </summary>
public static LocalisableString BehaviourDescription => new TranslatableString(getKey(@"behaviour_description"),
@"Some new defaults for game behaviours have been implemented, with the aim of improving the game experience and making it more accessible to everyone.
We recommend you give the new defaults a try, but if you'd like to have things feel more like classic versions of osu!, you can easily apply some sane defaults below.");
/// <summary>
/// "New defaults"
/// </summary>
public static LocalisableString NewDefaults => new TranslatableString(getKey(@"new_defaults"), @"New defaults");
/// <summary>
/// "Classic defaults"
/// </summary>
public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -0,0 +1,104 @@
// 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.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
namespace osu.Game.Overlays.FirstRunSetup
{
public class ScreenBehaviour : FirstRunSetupScreen
{
private SearchContainer<SettingsSection> searchContainer;
[BackgroundDependencyLoader]
private void load()
{
Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24))
{
Text = FirstRunSetupOverlayStrings.BehaviourDescription,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new[]
{
new TriangleButton
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Text = FirstRunSetupOverlayStrings.NewDefaults,
RelativeSizeAxes = Axes.X,
Action = applyStandard,
},
Empty(),
new DangerousTriangleButton
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Text = FirstRunSetupOverlayStrings.ClassicDefaults,
RelativeSizeAxes = Axes.X,
Action = applyClassic
}
},
},
},
searchContainer = new SearchContainer<SettingsSection>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new SettingsSection[]
{
new GeneralSection(),
new SkinSection(),
new UserInterfaceSection(),
new GameplaySection(),
new RulesetSection(),
new AudioSection(),
new GraphicsSection(),
new OnlineSection(),
new MaintenanceSection(),
new DebugSection(),
},
SearchTerm = SettingsItem<bool>.CLASSIC_DEFAULT_SEARCH_TERM,
}
};
}
private void applyClassic()
{
foreach (var i in searchContainer.ChildrenOfType<ISettingsItem>())
i.ApplyClassicDefault(true);
}
private void applyStandard()
{
foreach (var i in searchContainer.ChildrenOfType<ISettingsItem>())
i.ApplyClassicDefault(false);
}
}
}

View File

@ -70,6 +70,7 @@ namespace osu.Game.Overlays
{
new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.WelcomeTitle),
new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling),
new FirstRunStep(typeof(ScreenBehaviour), FirstRunSetupOverlayStrings.Behaviour),
};
private Container stackContainer = null!;