2023-12-28 07:05:20 +00: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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2023-12-28 07:19:12 +00:00
|
|
|
using osu.Framework.Bindables;
|
2023-12-28 07:05:20 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2023-12-28 07:16:27 +00:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2023-12-28 07:05:20 +00:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osuTK;
|
2023-12-28 07:16:27 +00:00
|
|
|
using osuTK.Graphics;
|
2023-12-28 07:05:20 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Menu
|
|
|
|
{
|
|
|
|
public partial class MenuTip : CompositeDrawable
|
|
|
|
{
|
|
|
|
[Resolved]
|
|
|
|
private OsuConfigManager config { get; set; } = null!;
|
|
|
|
|
|
|
|
private LinkFlowContainer textFlow = null!;
|
|
|
|
|
2023-12-28 07:19:12 +00:00
|
|
|
private Bindable<bool> showMenuTips = null!;
|
|
|
|
|
2023-12-28 07:05:20 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2023-12-28 07:16:27 +00:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Masking = true,
|
|
|
|
CornerExponent = 2.5f,
|
|
|
|
CornerRadius = 15,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
Colour = Color4.Black,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Alpha = 0.4f,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2023-12-28 07:05:20 +00:00
|
|
|
textFlow = new LinkFlowContainer
|
|
|
|
{
|
2023-12-28 07:16:27 +00:00
|
|
|
Width = 600,
|
2023-12-28 07:05:20 +00:00
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
TextAnchor = Anchor.TopCentre,
|
|
|
|
Spacing = new Vector2(0, 2),
|
2023-12-28 07:16:27 +00:00
|
|
|
Margin = new MarginPadding(10)
|
2023-12-28 07:05:20 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-12-28 07:19:12 +00:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
showMenuTips = config.GetBindable<bool>(OsuSetting.MenuTips);
|
|
|
|
showMenuTips.BindValueChanged(_ => ShowNextTip(), true);
|
|
|
|
}
|
|
|
|
|
2023-12-28 07:05:20 +00:00
|
|
|
public void ShowNextTip()
|
|
|
|
{
|
2023-12-28 07:19:12 +00:00
|
|
|
if (!showMenuTips.Value)
|
|
|
|
{
|
|
|
|
this.FadeOut(100, Easing.OutQuint);
|
|
|
|
return;
|
|
|
|
}
|
2023-12-28 07:05:20 +00:00
|
|
|
|
2023-12-28 07:16:27 +00:00
|
|
|
static void formatRegular(SpriteText t) => t.Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular);
|
|
|
|
static void formatSemiBold(SpriteText t) => t.Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold);
|
2023-12-28 07:05:20 +00:00
|
|
|
|
|
|
|
string tip = getRandomTip();
|
|
|
|
|
|
|
|
textFlow.Clear();
|
|
|
|
textFlow.AddParagraph("a tip for you:", formatSemiBold);
|
|
|
|
textFlow.AddParagraph(tip, formatRegular);
|
|
|
|
|
|
|
|
this.FadeInFromZero(200, Easing.OutQuint)
|
|
|
|
.Delay(1000 + 80 * tip.Length)
|
|
|
|
.Then()
|
2023-12-28 07:16:27 +00:00
|
|
|
.FadeOutFromOne(2000, Easing.OutQuint);
|
2023-12-28 07:05:20 +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!",
|
|
|
|
"All settings are dynamic and take effect in real-time. Try changing the skin while watching autoplay!",
|
|
|
|
"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!",
|
|
|
|
"What used to be \"osu!direct\" is available to all users just like on the website. You can access it anywhere using Ctrl-B!",
|
|
|
|
"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!",
|
|
|
|
"All delete operations are temporary until exiting. Restore accidentally deleted content from the maintenance settings!",
|
|
|
|
"Check out the \"playlists\" system, which lets users create their own custom and permanent leaderboards!",
|
|
|
|
"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)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|