1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 23:07:26 +08:00
osu-lazer/osu.Game/Screens/Menu/Disclaimer.cs

132 lines
4.6 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
2018-04-13 17:19:50 +08:00
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
2018-11-20 15:51:59 +08:00
using osuTK;
using osuTK.Graphics;
using osu.Game.Overlays;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Screens.Menu
{
public class Disclaimer : OsuScreen
{
private Intro intro;
private SpriteIcon icon;
2018-04-13 17:19:50 +08:00
private Color4 iconColour;
private LinkFlowContainer textFlow;
2018-04-13 17:19:50 +08:00
public override bool HideOverlaysOnEnter => true;
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
2018-04-13 17:19:50 +08:00
public override bool CursorVisible => false;
private readonly List<Drawable> supporterDrawables = new List<Drawable>();
private Drawable heart;
private const float icon_y = -85;
2018-04-13 17:19:50 +08:00
public Disclaimer()
{
ValidForResume = false;
}
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
2019-01-23 19:52:00 +08:00
InternalChildren = new Drawable[]
2018-04-13 17:19:50 +08:00
{
icon = new SpriteIcon
2018-04-13 17:19:50 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_warning,
Size = new Vector2(30),
Y = icon_y,
},
textFlow = new LinkFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(50),
TextAnchor = Anchor.TopCentre,
Y = -110,
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
2018-04-13 17:19:50 +08:00
Spacing = new Vector2(0, 2),
}
};
textFlow.AddText("This is an ", t => t.Font = t.Font.With(size: 30, weight: FontWeight.Light));
textFlow.AddText("early development build", t => t.Font = t.Font.With(size: 30, weight: FontWeight.SemiBold));
textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
textFlow.NewParagraph();
Action<SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold);
textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format);
textFlow.NewParagraph();
textFlow.AddText("Visit ", format);
textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters:format);
textFlow.AddText(" to help out or follow progress!", format);
textFlow.NewParagraph();
textFlow.NewParagraph();
textFlow.NewParagraph();
supporterDrawables.AddRange(textFlow.AddText("Consider becoming an ", format));
supporterDrawables.AddRange(textFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format));
supporterDrawables.AddRange(textFlow.AddText(" to help support the game", format));
supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t =>
{
t.Padding = new MarginPadding { Left = 5 };
t.Font = t.Font.With(size: 12);
t.Colour = colours.Pink;
t.Origin = Anchor.Centre;
}).First());
iconColour = colours.Yellow;
2018-04-13 17:19:50 +08:00
}
protected override void LoadComplete()
2018-04-13 17:19:50 +08:00
{
base.LoadComplete();
2018-04-13 17:19:50 +08:00
LoadComponentAsync(intro = new Intro());
}
2019-01-23 19:52:00 +08:00
public override void OnEntering(IScreen last)
2018-04-13 17:19:50 +08:00
{
base.OnEntering(last);
icon.Delay(1000).FadeColour(iconColour, 200, Easing.OutQuint);
icon.Delay(1000)
.MoveToY(icon_y * 1.1f, 160, Easing.OutCirc)
.RotateTo(-10, 160, Easing.OutCirc)
.Then()
.MoveToY(icon_y, 160, Easing.InCirc)
.RotateTo(0, 160, Easing.InCirc);
supporterDrawables.ForEach(d => d.FadeOut().Delay(2000).FadeIn(500));
2018-04-13 17:19:50 +08:00
2019-01-23 19:52:00 +08:00
this
2018-04-13 17:19:50 +08:00
.FadeInFromZero(500)
.Then(5500)
.FadeOut(250)
.ScaleTo(0.9f, 250, Easing.InQuint)
2019-01-23 19:52:00 +08:00
.Finally(d => this.Push(intro));
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
2018-04-13 17:19:50 +08:00
}
}
}