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-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 header_size = 40;
|
|
|
|
const float spacing = 20;
|
|
|
|
|
2022-04-19 15:37:29 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuScrollContainer(Direction.Vertical)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-04-26 14:55:32 +08:00
|
|
|
ScrollbarOverlapsContent = false,
|
2022-04-26 15:22:41 +08:00
|
|
|
Children = new Drawable[]
|
2022-04-19 15:37:29 +08:00
|
|
|
{
|
2022-04-26 15:22:41 +08:00
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = this.GetLocalisableDescription(),
|
|
|
|
Font = OsuFont.Default.With(size: header_size),
|
2022-04-28 17:57:32 +08:00
|
|
|
Colour = OverlayColourProvider.Light1,
|
2022-04-26 15:22:41 +08:00
|
|
|
},
|
|
|
|
Content = new FillFlowContainer
|
|
|
|
{
|
|
|
|
Y = header_size + spacing,
|
|
|
|
Spacing = new Vector2(spacing),
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|