Skip to content

Commit

Permalink
Merge pull request #18207 from peppy/first-run-finalise
Browse files Browse the repository at this point in the history
Improve first run overlay layout (and switch on)
  • Loading branch information
smoogipoo authored May 10, 2022
2 parents 09613c9 + 42fe708 commit 2e774fb
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public void TestBasic()
}

[Test]
[Ignore("Enable when first run setup is being displayed on first run.")]
public void TestDoesntOpenOnSecondRun()
{
AddStep("set first run", () => LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true));
Expand Down
43 changes: 26 additions & 17 deletions osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,46 @@ public abstract class FirstRunSetupScreen : Screen

protected FillFlowContainer Content { get; private set; }

protected const float CONTENT_FONT_SIZE = 16;

protected const float HEADER_FONT_SIZE = 24;

[Resolved]
protected OverlayColourProvider OverlayColourProvider { get; private set; }

[BackgroundDependencyLoader]
private void load()
{
const float header_size = 40;
const float spacing = 20;

InternalChildren = new Drawable[]
{
new OsuScrollContainer(Direction.Vertical)
{
RelativeSizeAxes = Axes.Both,
ScrollbarOverlapsContent = false,
Children = new Drawable[]
Masking = false,
Child = new Container
{
new OsuSpriteText
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 30 },
Children = new Drawable[]
{
Text = this.GetLocalisableDescription(),
Font = OsuFont.Default.With(size: header_size),
Colour = OverlayColourProvider.Light1,
new OsuSpriteText
{
Text = this.GetLocalisableDescription(),
Font = OsuFont.TorusAlternate.With(size: HEADER_FONT_SIZE),
Colour = OverlayColourProvider.Light1,
},
Content = new FillFlowContainer
{
Y = HEADER_FONT_SIZE + spacing,
Spacing = new Vector2(spacing),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
}
},
Content = new FillFlowContainer
{
Y = header_size + spacing,
Spacing = new Vector2(spacing),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
}
},
}
};
Expand All @@ -59,7 +68,7 @@ public override void OnEntering(ScreenTransitionEvent e)
{
base.OnEntering(e);
this
.FadeInFromZero(500)
.FadeInFromZero(100)
.MoveToX(offset)
.MoveToX(0, 500, Easing.OutQuint);
}
Expand All @@ -68,7 +77,7 @@ public override void OnResuming(ScreenTransitionEvent e)
{
base.OnResuming(e);
this
.FadeInFromZero(500)
.FadeInFromZero(100)
.MoveToX(0, 500, Easing.OutQuint);
}

Expand Down
14 changes: 7 additions & 7 deletions osu.Game/Overlays/FirstRunSetup/ScreenBeatmaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public class ScreenBeatmaps : FirstRunSetupScreen
[BackgroundDependencyLoader(permitNulls: true)]
private void load(LegacyImportManager? legacyImportManager)
{
Vector2 buttonSize = new Vector2(500, 60);
Vector2 buttonSize = new Vector2(400, 50);

Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Colour = OverlayColourProvider.Content1,
Text = FirstRunSetupBeatmapScreenStrings.Description,
Expand All @@ -63,7 +63,7 @@ private void load(LegacyImportManager? legacyImportManager)
Height = 30,
Children = new Drawable[]
{
currentlyLoadedBeatmaps = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold))
currentlyLoadedBeatmaps = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: HEADER_FONT_SIZE, weight: FontWeight.SemiBold))
{
Colour = OverlayColourProvider.Content2,
TextAnchor = Anchor.Centre,
Expand All @@ -73,7 +73,7 @@ private void load(LegacyImportManager? legacyImportManager)
},
}
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Colour = OverlayColourProvider.Content1,
Text = FirstRunSetupBeatmapScreenStrings.TutorialDescription,
Expand All @@ -89,7 +89,7 @@ private void load(LegacyImportManager? legacyImportManager)
Text = FirstRunSetupBeatmapScreenStrings.TutorialButton,
Action = downloadTutorial
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Colour = OverlayColourProvider.Content1,
Text = FirstRunSetupBeatmapScreenStrings.BundledDescription,
Expand All @@ -105,7 +105,7 @@ private void load(LegacyImportManager? legacyImportManager)
Text = FirstRunSetupBeatmapScreenStrings.BundledButton,
Action = downloadBundled
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Colour = OverlayColourProvider.Content1,
Text = "If you have an existing osu! install, you can also choose to import your existing beatmap collection.",
Expand All @@ -131,7 +131,7 @@ private void load(LegacyImportManager? legacyImportManager)
}));
}
},
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Colour = OverlayColourProvider.Content1,
Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps,
Expand Down
11 changes: 6 additions & 5 deletions osu.Game/Overlays/FirstRunSetup/ScreenBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using osu.Framework.Testing;
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.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
Expand All @@ -22,11 +22,11 @@ public class ScreenBehaviour : FirstRunSetupScreen
private SearchContainer<SettingsSection> searchContainer;

[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Text = FirstRunSetupOverlayStrings.BehaviourDescription,
RelativeSizeAxes = Axes.X,
Expand All @@ -50,7 +50,7 @@ private void load()
{
new[]
{
new TriangleButton
new RoundedButton
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Expand All @@ -59,10 +59,11 @@ private void load()
Action = applyStandard,
},
Empty(),
new DangerousTriangleButton
new RoundedButton
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
BackgroundColour = colours.Pink3,
Text = FirstRunSetupOverlayStrings.ClassicDefaults,
RelativeSizeAxes = Axes.X,
Action = applyClassic
Expand Down
21 changes: 13 additions & 8 deletions osu.Game/Overlays/FirstRunSetup/ScreenUIScale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ public class ScreenUIScale : FirstRunSetupScreen
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
const float screen_width = 640;

Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Text = FirstRunSetupOverlayStrings.UIScaleDescription,
RelativeSizeAxes = Axes.X,
Expand All @@ -54,7 +56,7 @@ private void load(OsuConfigManager config)
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.None,
Size = new Vector2(960, 960 / 16f * 9 / 2),
Size = new Vector2(screen_width, screen_width / 16f * 9 / 2),
Children = new Drawable[]
{
new GridContainer
Expand Down Expand Up @@ -123,6 +125,7 @@ private class UIScaleSlider : OsuSliderBar<float>

private class SampleScreenContainer : CompositeDrawable
{
private readonly OsuScreen screen;
// Minimal isolation from main game.

[Cached]
Expand All @@ -142,20 +145,21 @@ private class SampleScreenContainer : CompositeDrawable
public override bool PropagatePositionalInputSubTree => false;
public override bool PropagateNonPositionalInputSubTree => false;

public SampleScreenContainer(OsuScreen screen)
{
this.screen = screen;
RelativeSizeAxes = Axes.Both;
}

[BackgroundDependencyLoader]
private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets)
{
Beatmap.Value = new DummyWorkingBeatmap(audio, textures);
Beatmap.Value.LoadTrack();

Ruleset.Value = rulesets.AvailableRulesets.First();
}

public SampleScreenContainer(Screen screen)
{
OsuScreenStack stack;
RelativeSizeAxes = Axes.Both;

OsuLogo logo;

Padding = new MarginPadding(5);
Expand Down Expand Up @@ -189,7 +193,8 @@ public SampleScreenContainer(Screen screen)
},
};

stack.Push(screen);
// intentionally load synchronously so it is included in the initial load of the first run screen.
stack.PushSynchronously(screen);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Overlays/FirstRunSetup/ScreenWelcome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private void load()
{
Content.Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{
Text = FirstRunSetupOverlayStrings.WelcomeDescription,
RelativeSizeAxes = Axes.X,
Expand Down
Loading

0 comments on commit 2e774fb

Please sign in to comment.