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-04-26 15:22:41 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Extensions;
|
2022-04-06 16:42:10 +08:00
|
|
|
using osu.Framework.Graphics;
|
2022-04-19 15:37:29 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-04-06 16:42:10 +08:00
|
|
|
using osu.Framework.Screens;
|
2022-04-26 15:22:41 +08:00
|
|
|
using osu.Game.Graphics;
|
2022-04-19 15:37:29 +08:00
|
|
|
using osu.Game.Graphics.Containers;
|
2022-04-26 15:22:41 +08:00
|
|
|
using osu.Game.Graphics.Sprites;
|
2022-04-19 15:37:29 +08:00
|
|
|
using osuTK;
|
2022-04-06 16:42:10 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays.FirstRunSetup
|
|
|
|
{
|
|
|
|
public abstract class FirstRunSetupScreen : Screen
|
|
|
|
{
|
2022-04-18 17:58:14 +08:00
|
|
|
private const float offset = 100;
|
2022-04-06 16:42:10 +08:00
|
|
|
|
2022-04-19 15:37:29 +08:00
|
|
|
protected FillFlowContainer Content { get; private set; }
|
|
|
|
|
2022-05-10 16:33:37 +08:00
|
|
|
protected const float CONTENT_FONT_SIZE = 16;
|
|
|
|
|
|
|
|
protected const float HEADER_FONT_SIZE = 24;
|
|
|
|
|
2022-04-28 17:57:32 +08:00
|
|
|
[Resolved]
|
|
|
|
protected OverlayColourProvider OverlayColourProvider { get; private set; }
|
|
|
|
|
2022-04-26 15:22:41 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2022-04-28 17:57:32 +08:00
|
|
|
private void load()
|
2022-04-19 15:37:29 +08:00
|
|
|
{
|
2022-04-26 15:22:41 +08:00
|
|
|
const float spacing = 20;
|
|
|
|
|
2022-04-19 15:37:29 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuScrollContainer(Direction.Vertical)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-10 16:23:12 +08:00
|
|
|
Masking = false,
|
|
|
|
Child = new Container
|
2022-04-19 15:37:29 +08:00
|
|
|
{
|
2022-05-10 16:23:12 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Padding = new MarginPadding { Horizontal = 30 },
|
|
|
|
Children = new Drawable[]
|
2022-04-26 15:22:41 +08:00
|
|
|
{
|
2022-05-10 16:23:12 +08:00
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = this.GetLocalisableDescription(),
|
2022-05-10 16:33:37 +08:00
|
|
|
Font = OsuFont.TorusAlternate.With(size: HEADER_FONT_SIZE),
|
2022-05-10 16:23:12 +08:00
|
|
|
Colour = OverlayColourProvider.Light1,
|
|
|
|
},
|
|
|
|
Content = new FillFlowContainer
|
|
|
|
{
|
2022-05-10 16:33:37 +08:00
|
|
|
Y = HEADER_FONT_SIZE + spacing,
|
2022-05-10 16:23:12 +08:00
|
|
|
Spacing = new Vector2(spacing),
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
}
|
2022-04-26 15:22:41 +08:00
|
|
|
},
|
2022-04-19 15:37:29 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
public override void OnEntering(ScreenTransitionEvent e)
|
2022-04-06 16:42:10 +08:00
|
|
|
{
|
2022-04-22 04:29:23 +08:00
|
|
|
base.OnEntering(e);
|
2022-04-18 15:07:30 +08:00
|
|
|
this
|
|
|
|
.FadeInFromZero(500)
|
2022-04-18 17:58:14 +08:00
|
|
|
.MoveToX(offset)
|
2022-04-18 15:07:30 +08:00
|
|
|
.MoveToX(0, 500, Easing.OutQuint);
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
public override void OnResuming(ScreenTransitionEvent e)
|
2022-04-06 16:42:10 +08:00
|
|
|
{
|
2022-04-22 04:29:23 +08:00
|
|
|
base.OnResuming(e);
|
2022-04-18 15:07:30 +08:00
|
|
|
this
|
|
|
|
.FadeInFromZero(500)
|
|
|
|
.MoveToX(0, 500, Easing.OutQuint);
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
public override bool OnExiting(ScreenExitEvent e)
|
2022-04-18 17:58:14 +08:00
|
|
|
{
|
|
|
|
this
|
|
|
|
.FadeOut(100)
|
|
|
|
.MoveToX(offset, 500, Easing.OutQuint);
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
return base.OnExiting(e);
|
2022-04-18 17:58:14 +08:00
|
|
|
}
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
public override void OnSuspending(ScreenTransitionEvent e)
|
2022-04-06 16:42:10 +08:00
|
|
|
{
|
2022-04-18 15:07:30 +08:00
|
|
|
this
|
|
|
|
.FadeOut(100)
|
2022-04-18 17:58:14 +08:00
|
|
|
.MoveToX(-offset, 500, Easing.OutQuint);
|
|
|
|
|
2022-04-22 04:29:23 +08:00
|
|
|
base.OnSuspending(e);
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|