2019-03-13 11:57:01 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-01-22 13:22:38 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-26 22:26:00 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-03-13 11:57:01 +08:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-13 11:57:01 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-01-22 13:22:38 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
|
using osu.Game.Graphics;
|
2018-07-11 15:30:33 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2019-02-26 06:44:43 +08:00
|
|
|
|
using osu.Game.Online.API;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2019-02-26 22:26:00 +08:00
|
|
|
|
using osu.Game.Users;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Menu
|
|
|
|
|
{
|
2019-06-26 00:36:17 +08:00
|
|
|
|
public class Disclaimer : StartupScreen
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-07-11 15:30:33 +08:00
|
|
|
|
private SpriteIcon icon;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private Color4 iconColour;
|
2018-07-11 15:30:33 +08:00
|
|
|
|
private LinkFlowContainer textFlow;
|
2019-03-13 11:57:01 +08:00
|
|
|
|
private LinkFlowContainer supportFlow;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-01-22 13:22:38 +08:00
|
|
|
|
private Drawable heart;
|
|
|
|
|
|
|
|
|
|
private const float icon_y = -85;
|
2019-03-13 11:57:01 +08:00
|
|
|
|
private const float icon_size = 30;
|
2018-07-11 15:30:33 +08:00
|
|
|
|
|
2019-07-09 17:06:49 +08:00
|
|
|
|
private readonly OsuScreen nextScreen;
|
|
|
|
|
|
2019-03-03 02:13:38 +08:00
|
|
|
|
private readonly Bindable<User> currentUser = new Bindable<User>();
|
2019-02-26 22:26:00 +08:00
|
|
|
|
|
2019-07-09 17:06:49 +08:00
|
|
|
|
public Disclaimer(OsuScreen nextScreen = null)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-07-09 17:06:49 +08:00
|
|
|
|
this.nextScreen = nextScreen;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
ValidForResume = false;
|
2018-07-11 15:30:33 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-07-11 15:30:33 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2019-03-13 11:56:47 +08:00
|
|
|
|
private void load(OsuColour colours, IAPIProvider api)
|
2018-07-11 15:30:33 +08:00
|
|
|
|
{
|
2019-01-23 19:52:00 +08:00
|
|
|
|
InternalChildren = new Drawable[]
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-07-11 15:30:33 +08:00
|
|
|
|
icon = new SpriteIcon
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Solid.ExclamationTriangle,
|
2019-03-13 11:57:01 +08:00
|
|
|
|
Size = new Vector2(icon_size),
|
2018-07-11 15:30:33 +08:00
|
|
|
|
Y = icon_y,
|
|
|
|
|
},
|
2019-03-13 11:57:01 +08:00
|
|
|
|
new FillFlowContainer
|
2018-07-11 15:30:33 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-03-13 11:57:01 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Y = icon_y + icon_size,
|
2018-07-11 15:30:33 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
2019-01-22 13:22:38 +08:00
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-03-13 11:57:01 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
textFlow = new LinkFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
TextAnchor = Anchor.TopCentre,
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Spacing = new Vector2(0, 2),
|
|
|
|
|
},
|
|
|
|
|
supportFlow = new LinkFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
TextAnchor = Anchor.TopCentre,
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-03-19 15:11:22 +08:00
|
|
|
|
Alpha = 0,
|
2019-03-13 11:57:01 +08:00
|
|
|
|
Spacing = new Vector2(0, 2),
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2018-07-11 15:30:33 +08:00
|
|
|
|
|
2019-02-21 18:26:02 +08:00
|
|
|
|
textFlow.AddText("This is an ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
|
|
|
|
|
textFlow.AddText("early development build", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));
|
2018-07-11 15:30:33 +08:00
|
|
|
|
|
2019-02-20 18:32:30 +08:00
|
|
|
|
textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
|
2019-01-22 13:22:38 +08:00
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
|
2019-03-02 12:25:59 +08:00
|
|
|
|
Action<SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);
|
2019-01-22 13:22:38 +08:00
|
|
|
|
|
|
|
|
|
textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format);
|
|
|
|
|
textFlow.NewParagraph();
|
2018-07-11 15:30:33 +08:00
|
|
|
|
|
2019-01-22 13:22:38 +08:00
|
|
|
|
textFlow.AddText("Visit ", format);
|
2019-02-28 12:31:40 +08:00
|
|
|
|
textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format);
|
2019-01-22 13:22:38 +08:00
|
|
|
|
textFlow.AddText(" to help out or follow progress!", format);
|
|
|
|
|
|
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
|
2018-07-11 15:30:33 +08:00
|
|
|
|
iconColour = colours.Yellow;
|
2019-03-03 02:13:38 +08:00
|
|
|
|
|
|
|
|
|
currentUser.BindTo(api.LocalUser);
|
|
|
|
|
currentUser.BindValueChanged(e =>
|
|
|
|
|
{
|
2019-03-19 15:10:28 +08:00
|
|
|
|
supportFlow.Children.ForEach(d => d.FadeOut().Expire());
|
2019-03-13 11:57:01 +08:00
|
|
|
|
|
2019-03-03 02:13:38 +08:00
|
|
|
|
if (e.NewValue.IsSupporter)
|
2019-03-13 11:57:01 +08:00
|
|
|
|
{
|
|
|
|
|
supportFlow.AddText("Thank you for supporting osu!", format);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
supportFlow.AddText("Consider becoming an ", format);
|
|
|
|
|
supportFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format);
|
|
|
|
|
supportFlow.AddText(" to help support the game", format);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-02 18:55:24 +08:00
|
|
|
|
heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t =>
|
2019-03-13 11:57:01 +08:00
|
|
|
|
{
|
|
|
|
|
t.Padding = new MarginPadding { Left = 5 };
|
|
|
|
|
t.Font = t.Font.With(size: 12);
|
|
|
|
|
t.Origin = Anchor.Centre;
|
|
|
|
|
t.Colour = colours.Pink;
|
|
|
|
|
}).First();
|
|
|
|
|
|
|
|
|
|
if (IsLoaded)
|
|
|
|
|
animateHeart();
|
2019-03-19 15:10:28 +08:00
|
|
|
|
|
|
|
|
|
if (supportFlow.IsPresent)
|
|
|
|
|
supportFlow.FadeInFromZero(500);
|
2019-03-03 02:13:38 +08:00
|
|
|
|
}, true);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 11:57:01 +08:00
|
|
|
|
private void animateHeart()
|
|
|
|
|
{
|
|
|
|
|
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-11 15:30:33 +08:00
|
|
|
|
protected override void LoadComplete()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-07-11 15:30:33 +08:00
|
|
|
|
base.LoadComplete();
|
2019-07-09 17:06:49 +08:00
|
|
|
|
if (nextScreen != null)
|
|
|
|
|
LoadComponentAsync(nextScreen);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
|
2019-01-22 13:22:38 +08:00
|
|
|
|
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);
|
|
|
|
|
|
2019-03-13 11:57:01 +08:00
|
|
|
|
supportFlow.FadeOut().Delay(2000).FadeIn(500);
|
|
|
|
|
|
|
|
|
|
animateHeart();
|
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)
|
2018-07-11 15:30:33 +08:00
|
|
|
|
.ScaleTo(0.9f, 250, Easing.InQuint)
|
2019-07-09 17:06:49 +08:00
|
|
|
|
.Finally(d => this.Push(nextScreen));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|