1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 15:17:44 +08:00
osu-lazer/osu.Game/Overlays/FirstRunSetup/FirstRunSetupScreen.cs

107 lines
3.3 KiB
C#
Raw Normal View History

2022-04-06 16:42:10 +08:00
// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Extensions;
2022-04-06 16:42:10 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2022-04-06 16:42:10 +08:00
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
2022-04-06 16:42:10 +08:00
namespace osu.Game.Overlays.FirstRunSetup
{
2022-11-24 13:32:20 +08:00
public abstract partial class FirstRunSetupScreen : Screen
2022-04-06 16:42:10 +08:00
{
2022-04-18 17:58:14 +08:00
private const float offset = 100;
2022-04-06 16:42:10 +08:00
protected FillFlowContainer Content { get; private set; }
protected const float CONTENT_FONT_SIZE = 16;
2022-05-16 20:07:42 +08:00
protected const float CONTENT_PADDING = 30;
protected const float HEADER_FONT_SIZE = 24;
[Resolved]
protected OverlayColourProvider OverlayColourProvider { get; private set; }
[BackgroundDependencyLoader]
private void load()
{
const float spacing = 20;
InternalChildren = new Drawable[]
{
new OsuScrollContainer(Direction.Vertical)
{
RelativeSizeAxes = Axes.Both,
Masking = false,
Child = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2022-05-16 20:07:42 +08:00
Padding = new MarginPadding { Horizontal = CONTENT_PADDING },
Children = new Drawable[]
{
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,
}
},
},
}
};
}
public override void OnEntering(ScreenTransitionEvent e)
2022-04-06 16:42:10 +08:00
{
base.OnEntering(e);
this
.FadeInFromZero(100)
2022-04-18 17:58:14 +08:00
.MoveToX(offset)
.MoveToX(0, 500, Easing.OutQuint);
2022-04-06 16:42:10 +08:00
}
public override void OnResuming(ScreenTransitionEvent e)
2022-04-06 16:42:10 +08:00
{
base.OnResuming(e);
this
.FadeInFromZero(100)
.MoveToX(0, 500, Easing.OutQuint);
2022-04-06 16:42:10 +08:00
}
public override bool OnExiting(ScreenExitEvent e)
2022-04-18 17:58:14 +08:00
{
this
.FadeOut(100)
.MoveToX(offset, 500, Easing.OutQuint);
return base.OnExiting(e);
2022-04-18 17:58:14 +08:00
}
public override void OnSuspending(ScreenTransitionEvent e)
2022-04-06 16:42:10 +08:00
{
this
.FadeOut(100)
2022-04-18 17:58:14 +08:00
.MoveToX(-offset, 500, Easing.OutQuint);
base.OnSuspending(e);
2022-04-06 16:42:10 +08:00
}
}
}