2019-03-13 03:57:01 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 08:43:03 +00:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-01-22 05:22:38 +00:00
|
|
|
|
using System.Linq;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-26 14:26:00 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-03-13 03:57:01 +00:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-13 03:57:01 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-01-22 05:22:38 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Screens;
|
2020-03-10 17:35:49 +00:00
|
|
|
|
using osu.Framework.Utils;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2018-07-11 07:30:33 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2019-02-25 22:44:43 +00:00
|
|
|
|
using osu.Game.Online.API;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2019-02-26 14:26:00 +00:00
|
|
|
|
using osu.Game.Users;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Menu
|
|
|
|
|
{
|
2019-06-25 16:36:17 +00:00
|
|
|
|
public class Disclaimer : StartupScreen
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2018-07-11 07:30:33 +00:00
|
|
|
|
private SpriteIcon icon;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
private Color4 iconColour;
|
2018-07-11 07:30:33 +00:00
|
|
|
|
private LinkFlowContainer textFlow;
|
2019-03-13 03:57:01 +00:00
|
|
|
|
private LinkFlowContainer supportFlow;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-01-22 05:22:38 +00:00
|
|
|
|
private Drawable heart;
|
|
|
|
|
|
|
|
|
|
private const float icon_y = -85;
|
2019-03-13 03:57:01 +00:00
|
|
|
|
private const float icon_size = 30;
|
2018-07-11 07:30:33 +00:00
|
|
|
|
|
2019-07-09 09:06:49 +00:00
|
|
|
|
private readonly OsuScreen nextScreen;
|
|
|
|
|
|
2019-03-02 18:13:38 +00:00
|
|
|
|
private readonly Bindable<User> currentUser = new Bindable<User>();
|
2020-03-10 17:35:49 +00:00
|
|
|
|
private FillFlowContainer fill;
|
2019-02-26 14:26:00 +00:00
|
|
|
|
|
2019-07-09 09:06:49 +00:00
|
|
|
|
public Disclaimer(OsuScreen nextScreen = null)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-07-09 09:06:49 +00:00
|
|
|
|
this.nextScreen = nextScreen;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
ValidForResume = false;
|
2018-07-11 07:30:33 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-07-11 07:30:33 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2019-03-13 03:56:47 +00:00
|
|
|
|
private void load(OsuColour colours, IAPIProvider api)
|
2018-07-11 07:30:33 +00:00
|
|
|
|
{
|
2019-01-23 11:52:00 +00:00
|
|
|
|
InternalChildren = new Drawable[]
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2018-07-11 07:30:33 +00:00
|
|
|
|
icon = new SpriteIcon
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2020-07-09 03:31:20 +00:00
|
|
|
|
Icon = FontAwesome.Solid.Flask,
|
2019-03-13 03:57:01 +00:00
|
|
|
|
Size = new Vector2(icon_size),
|
2018-07-11 07:30:33 +00:00
|
|
|
|
Y = icon_y,
|
|
|
|
|
},
|
2020-03-10 17:35:49 +00:00
|
|
|
|
fill = new FillFlowContainer
|
2018-07-11 07:30:33 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-03-13 03:57:01 +00:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-03-10 17:35:49 +00:00
|
|
|
|
Y = icon_y,
|
2018-07-11 07:30:33 +00:00
|
|
|
|
Anchor = Anchor.Centre,
|
2019-01-22 05:22:38 +00:00
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-03-13 03:57:01 +00: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),
|
2020-03-10 17:35:49 +00:00
|
|
|
|
LayoutDuration = 2000,
|
|
|
|
|
LayoutEasing = Easing.OutQuint
|
2019-03-13 03:57:01 +00:00
|
|
|
|
},
|
|
|
|
|
supportFlow = new LinkFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
TextAnchor = Anchor.TopCentre,
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-03-19 07:11:22 +00:00
|
|
|
|
Alpha = 0,
|
2019-03-13 03:57:01 +00:00
|
|
|
|
Spacing = new Vector2(0, 2),
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2018-07-11 07:30:33 +00:00
|
|
|
|
|
2020-03-13 04:32:16 +00:00
|
|
|
|
textFlow.AddText("This project is an ongoing ", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.Light));
|
|
|
|
|
textFlow.AddText("work in progress", t => t.Font = t.Font.With(Typeface.Torus, 30, FontWeight.SemiBold));
|
2018-07-11 07:30:33 +00:00
|
|
|
|
|
2019-01-22 05:22:38 +00:00
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
|
2019-11-12 12:12:11 +00:00
|
|
|
|
static void format(SpriteText t) => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);
|
2019-01-22 05:22:38 +00:00
|
|
|
|
|
2020-03-13 04:32:16 +00:00
|
|
|
|
textFlow.AddParagraph(getRandomTip(), t => t.Font = t.Font.With(Typeface.Torus, 20, FontWeight.SemiBold));
|
2019-01-22 05:22:38 +00:00
|
|
|
|
textFlow.NewParagraph();
|
2018-07-11 07:30:33 +00:00
|
|
|
|
|
2019-01-22 05:22:38 +00:00
|
|
|
|
textFlow.NewParagraph();
|
|
|
|
|
|
2018-07-11 07:30:33 +00:00
|
|
|
|
iconColour = colours.Yellow;
|
2019-03-02 18:13:38 +00:00
|
|
|
|
|
|
|
|
|
currentUser.BindTo(api.LocalUser);
|
|
|
|
|
currentUser.BindValueChanged(e =>
|
|
|
|
|
{
|
2019-03-19 07:10:28 +00:00
|
|
|
|
supportFlow.Children.ForEach(d => d.FadeOut().Expire());
|
2019-03-13 03:57:01 +00:00
|
|
|
|
|
2019-03-02 18:13:38 +00:00
|
|
|
|
if (e.NewValue.IsSupporter)
|
2019-03-13 03:57:01 +00:00
|
|
|
|
{
|
2020-03-10 17:35:49 +00:00
|
|
|
|
supportFlow.AddText("Eternal thanks to you for supporting osu!", format);
|
2019-03-13 03:57:01 +00:00
|
|
|
|
}
|
|
|
|
|
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 10:55:24 +00:00
|
|
|
|
heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t =>
|
2019-03-13 03:57:01 +00:00
|
|
|
|
{
|
2020-03-10 17:35:49 +00:00
|
|
|
|
t.Padding = new MarginPadding { Left = 5, Top = 3 };
|
2019-03-13 03:57:01 +00:00
|
|
|
|
t.Font = t.Font.With(size: 12);
|
|
|
|
|
t.Origin = Anchor.Centre;
|
|
|
|
|
t.Colour = colours.Pink;
|
|
|
|
|
}).First();
|
|
|
|
|
|
|
|
|
|
if (IsLoaded)
|
|
|
|
|
animateHeart();
|
2019-03-19 07:10:28 +00:00
|
|
|
|
|
|
|
|
|
if (supportFlow.IsPresent)
|
|
|
|
|
supportFlow.FadeInFromZero(500);
|
2019-03-02 18:13:38 +00:00
|
|
|
|
}, true);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-11 07:30:33 +00:00
|
|
|
|
protected override void LoadComplete()
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2018-07-11 07:30:33 +00:00
|
|
|
|
base.LoadComplete();
|
2019-07-09 09:06:49 +00:00
|
|
|
|
if (nextScreen != null)
|
|
|
|
|
LoadComponentAsync(nextScreen);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-23 11:52:00 +00:00
|
|
|
|
public override void OnEntering(IScreen last)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnEntering(last);
|
|
|
|
|
|
2020-03-10 17:35:49 +00:00
|
|
|
|
icon.RotateTo(10);
|
|
|
|
|
icon.FadeOut();
|
|
|
|
|
icon.ScaleTo(0.5f);
|
|
|
|
|
|
|
|
|
|
icon.Delay(500).FadeIn(500).ScaleTo(1, 500, Easing.OutQuint);
|
|
|
|
|
|
|
|
|
|
using (BeginDelayedSequence(3000, true))
|
|
|
|
|
{
|
|
|
|
|
icon.FadeColour(iconColour, 200, Easing.OutQuint);
|
|
|
|
|
icon.MoveToY(icon_y * 1.3f, 500, Easing.OutCirc)
|
|
|
|
|
.RotateTo(-360, 520, Easing.OutQuint)
|
|
|
|
|
.Then()
|
|
|
|
|
.MoveToY(icon_y, 160, Easing.InQuart)
|
|
|
|
|
.FadeColour(Color4.White, 160);
|
|
|
|
|
|
|
|
|
|
fill.Delay(520 + 160).MoveToOffset(new Vector2(0, 15), 160, Easing.OutQuart);
|
|
|
|
|
}
|
2019-01-22 05:22:38 +00:00
|
|
|
|
|
2019-03-13 03:57:01 +00:00
|
|
|
|
supportFlow.FadeOut().Delay(2000).FadeIn(500);
|
2020-03-10 17:35:49 +00:00
|
|
|
|
double delay = 500;
|
|
|
|
|
foreach (var c in textFlow.Children)
|
|
|
|
|
c.FadeTo(0.001f).Delay(delay += 20).FadeIn(500);
|
2019-03-13 03:57:01 +00:00
|
|
|
|
|
|
|
|
|
animateHeart();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-01-23 11:52:00 +00:00
|
|
|
|
this
|
2018-04-13 09:19:50 +00:00
|
|
|
|
.FadeInFromZero(500)
|
|
|
|
|
.Then(5500)
|
|
|
|
|
.FadeOut(250)
|
2018-07-11 07:30:33 +00:00
|
|
|
|
.ScaleTo(0.9f, 250, Easing.InQuint)
|
2019-09-17 06:54:11 +00:00
|
|
|
|
.Finally(d =>
|
|
|
|
|
{
|
|
|
|
|
if (nextScreen != null)
|
|
|
|
|
this.Push(nextScreen);
|
|
|
|
|
});
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
2020-03-10 17:35:49 +00:00
|
|
|
|
|
|
|
|
|
private string getRandomTip()
|
|
|
|
|
{
|
|
|
|
|
string[] tips =
|
|
|
|
|
{
|
|
|
|
|
"You can press Ctrl-T anywhere in the game to toggle the toolbar!",
|
|
|
|
|
"You can press Ctrl-O anywhere in the game to access options!",
|
2020-08-05 09:21:09 +00:00
|
|
|
|
"All settings are dynamic and take effect in real-time. Try pausing and changing the skin while playing!",
|
2020-03-10 17:35:49 +00:00
|
|
|
|
"New features are coming online every update. Make sure to stay up-to-date!",
|
|
|
|
|
"If you find the UI too large or small, try adjusting UI scale in settings!",
|
|
|
|
|
"Try adjusting the \"Screen Scaling\" mode to change your gameplay or UI area, even in fullscreen!",
|
|
|
|
|
"For now, osu!direct is available to all users on lazer. You can access it anywhere using Ctrl-D!",
|
|
|
|
|
"Seeking in replays is available by dragging on the difficulty bar at the bottom of the screen!",
|
|
|
|
|
"Multithreading support means that even with low \"FPS\" your input and judgements will be accurate!",
|
|
|
|
|
"Try scrolling down in the mod select panel to find a bunch of new fun mods!",
|
|
|
|
|
"Most of the web content (profiles, rankings, etc.) are available natively in-game from the icons on the toolbar!",
|
|
|
|
|
"Get more details, hide or delete a beatmap by right-clicking on its panel at song select!",
|
2020-03-11 04:23:26 +00:00
|
|
|
|
"All delete operations are temporary until exiting. Restore accidentally deleted content from the maintenance settings!",
|
2020-03-10 17:35:49 +00:00
|
|
|
|
"Check out the \"timeshift\" multiplayer system, which has local permanent leaderboards and playlist support!",
|
|
|
|
|
"Toggle advanced frame / thread statistics with Ctrl-F11!",
|
|
|
|
|
"Take a look under the hood at performance counters and enable verbose performance logging with Ctrl-F2!",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return tips[RNG.Next(0, tips.Length)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void animateHeart()
|
|
|
|
|
{
|
|
|
|
|
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|