2023-12-28 15:05:20 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2023-12-28 15:19:12 +08:00
|
|
|
using osu.Framework.Bindables;
|
2023-12-28 15:05:20 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2023-12-28 15:16:27 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2023-12-28 15:05:20 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2024-11-24 21:22:56 +08:00
|
|
|
using osu.Framework.Localisation;
|
2023-12-28 15:05:20 +08:00
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osuTK;
|
2023-12-28 15:16:27 +08:00
|
|
|
using osuTK.Graphics;
|
2024-11-24 21:22:56 +08:00
|
|
|
using osu.Game.Localisation;
|
2023-12-28 15:05:20 +08: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 15:19:12 +08:00
|
|
|
private Bindable<bool> showMenuTips = null!;
|
|
|
|
|
2023-12-28 15:05:20 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2023-12-28 15:16:27 +08: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 15:05:20 +08:00
|
|
|
textFlow = new LinkFlowContainer
|
|
|
|
{
|
2023-12-28 15:16:27 +08:00
|
|
|
Width = 600,
|
2023-12-28 15:05:20 +08:00
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
TextAnchor = Anchor.TopCentre,
|
|
|
|
Spacing = new Vector2(0, 2),
|
2023-12-28 15:16:27 +08:00
|
|
|
Margin = new MarginPadding(10)
|
2023-12-28 15:05:20 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-12-28 15:19:12 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
showMenuTips = config.GetBindable<bool>(OsuSetting.MenuTips);
|
|
|
|
showMenuTips.BindValueChanged(_ => ShowNextTip(), true);
|
|
|
|
}
|
|
|
|
|
2023-12-28 15:05:20 +08:00
|
|
|
public void ShowNextTip()
|
|
|
|
{
|
2023-12-28 15:19:12 +08:00
|
|
|
if (!showMenuTips.Value)
|
|
|
|
{
|
|
|
|
this.FadeOut(100, Easing.OutQuint);
|
|
|
|
return;
|
|
|
|
}
|
2023-12-28 15:05:20 +08:00
|
|
|
|
2023-12-28 15:16:27 +08: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 15:05:20 +08:00
|
|
|
|
2024-11-24 21:22:56 +08:00
|
|
|
var tip = getRandomTip();
|
2023-12-28 15:05:20 +08:00
|
|
|
|
|
|
|
textFlow.Clear();
|
2024-11-24 21:22:56 +08:00
|
|
|
textFlow.AddParagraph(MenuTipStrings.MenuTipTitle, formatSemiBold);
|
2023-12-28 15:05:20 +08:00
|
|
|
textFlow.AddParagraph(tip, formatRegular);
|
|
|
|
|
|
|
|
this.FadeInFromZero(200, Easing.OutQuint)
|
2024-11-24 21:22:56 +08:00
|
|
|
.Delay(1000 + 80 * tip.ToString().Length)
|
2023-12-28 15:05:20 +08:00
|
|
|
.Then()
|
2023-12-28 15:16:27 +08:00
|
|
|
.FadeOutFromOne(2000, Easing.OutQuint);
|
2023-12-28 15:05:20 +08:00
|
|
|
}
|
|
|
|
|
2024-11-24 21:22:56 +08:00
|
|
|
private LocalisableString getRandomTip()
|
2023-12-28 15:05:20 +08:00
|
|
|
{
|
2024-11-24 21:22:56 +08:00
|
|
|
LocalisableString[] tips =
|
2023-12-28 15:05:20 +08:00
|
|
|
{
|
2024-11-24 21:22:56 +08:00
|
|
|
MenuTipStrings.ToggleToolbarShortcut,
|
|
|
|
MenuTipStrings.GameSettingsShortcut,
|
|
|
|
MenuTipStrings.DynamicSettings,
|
|
|
|
MenuTipStrings.NewFeaturesAreComingOnline,
|
|
|
|
MenuTipStrings.UIScalingSettings,
|
|
|
|
MenuTipStrings.ScreenScalingSettings,
|
|
|
|
MenuTipStrings.FreeOsuDirect,
|
|
|
|
MenuTipStrings.ReplaySeeking,
|
|
|
|
MenuTipStrings.MultithreadingSupport,
|
|
|
|
MenuTipStrings.TryNewMods,
|
|
|
|
MenuTipStrings.EmbeddedWebContent,
|
|
|
|
MenuTipStrings.BeatmapRightClick,
|
|
|
|
MenuTipStrings.TemporaryDeleteOperations,
|
|
|
|
MenuTipStrings.DiscoverPlaylists,
|
|
|
|
MenuTipStrings.ToggleAdvancedFPSCounter,
|
|
|
|
MenuTipStrings.GlobalStatisticsShortcut,
|
|
|
|
MenuTipStrings.ReplayPausing,
|
|
|
|
MenuTipStrings.ConfigurableHotkeys,
|
|
|
|
MenuTipStrings.PeekHUDWhenHidden,
|
|
|
|
MenuTipStrings.SkinEditor,
|
|
|
|
MenuTipStrings.DragAndDropImageInSkinEditor,
|
|
|
|
MenuTipStrings.ModPresets,
|
|
|
|
MenuTipStrings.ModCustomisationSettings,
|
|
|
|
MenuTipStrings.RandomSkinShortcut,
|
|
|
|
MenuTipStrings.ToggleReplaySettingsShortcut,
|
|
|
|
MenuTipStrings.CopyModsFromScore,
|
|
|
|
MenuTipStrings.AutoplayBeatmapShortcut
|
2023-12-28 15:05:20 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return tips[RNG.Next(0, tips.Length)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|