Move menu tips to main menu

In preparation for removing the disclaimer screen.
This commit is contained in:
Dean Herbert 2023-12-28 16:05:20 +09:00
parent 3a3b4d445c
commit a1867afbb4
No known key found for this signature in database
7 changed files with 138 additions and 35 deletions

View File

@ -96,6 +96,7 @@ protected override void InitialiseDefaults()
SetDefault(OsuSetting.MenuVoice, true);
SetDefault(OsuSetting.MenuMusic, true);
SetDefault(OsuSetting.MenuTips, true);
SetDefault(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1);
@ -350,6 +351,7 @@ public enum OsuSetting
VolumeInactive,
MenuMusic,
MenuVoice,
MenuTips,
CursorRotation,
MenuParallax,
Prefer24HourTime,

View File

@ -24,6 +24,11 @@ public static class UserInterfaceStrings
/// </summary>
public static LocalisableString MenuCursorSize => new TranslatableString(getKey(@"menu_cursor_size"), @"Menu cursor size");
/// <summary>
/// "Menu tips"
/// </summary>
public static LocalisableString ShowMenuTips => new TranslatableString(getKey(@"show_menu_tips"), @"Menu tips");
/// <summary>
/// "Parallax"
/// </summary>
@ -154,6 +159,6 @@ public static class UserInterfaceStrings
/// </summary>
public static LocalisableString TrueRandom => new TranslatableString(getKey(@"true_random"), @"True Random");
private static string getKey(string key) => $"{prefix}:{key}";
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -29,6 +29,11 @@ private void load(OsuConfigManager config, IAPIProvider api)
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = UserInterfaceStrings.ShowMenuTips,
Current = config.GetBindable<bool>(OsuSetting.MenuTips)
},
new SettingsCheckbox
{
LabelText = UserInterfaceStrings.InterfaceVoices,

View File

@ -12,7 +12,6 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
@ -122,10 +121,6 @@ private void load(OsuColour colours)
textFlow.NewParagraph();
textFlow.NewParagraph();
textFlow.AddParagraph("today's tip:", formatSemiBold);
textFlow.AddParagraph(getRandomTip(), formatRegular);
textFlow.NewParagraph();
textFlow.NewParagraph();
iconColour = colours.Yellow;
@ -228,30 +223,5 @@ public override void OnEntering(ScreenTransitionEvent e)
this.Push(nextScreen);
});
}
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 pausing and changing the skin while playing!",
"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)];
}
}
}

View File

@ -95,6 +95,8 @@ public partial class MainMenu : OsuScreen, IHandlePresentBeatmap, IKeyBindingHan
private SongTicker songTicker;
private Container logoTarget;
private SystemTitle systemTitle;
private MenuTip menuTip;
private FillFlowContainer bottomElementsFlow;
private Sample reappearSampleSwoosh;
@ -157,7 +159,27 @@ private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings
Margin = new MarginPadding { Right = 15, Top = 5 }
},
new KiaiMenuFountains(),
systemTitle = new SystemTitle(),
bottomElementsFlow = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Spacing = new Vector2(15),
Children = new Drawable[]
{
menuTip = new MenuTip
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
systemTitle = new SystemTitle
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
}
},
holdToExitGameOverlay?.CreateProxy() ?? Empty()
});
@ -220,6 +242,8 @@ public override void OnEntering(ScreenTransitionEvent e)
if (storage is OsuStorage osuStorage && osuStorage.Error != OsuStorageError.None)
dialogOverlay?.Push(new StorageErrorDialog(osuStorage, osuStorage.Error));
menuTip.ShowNextTip();
}
[CanBeNull]
@ -272,7 +296,7 @@ protected override void Update()
{
base.Update();
systemTitle.Margin = new MarginPadding
bottomElementsFlow.Margin = new MarginPadding
{
Bottom = (versionManager?.DrawHeight + 5) ?? 0
};
@ -314,6 +338,10 @@ public override void OnSuspending(ScreenTransitionEvent e)
buttonsContainer.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
sideFlashes.FadeOut(64, Easing.OutQuint);
bottomElementsFlow
.ScaleTo(0.9f, 1000, Easing.OutQuint)
.FadeOut(500, Easing.OutQuint);
}
public override void OnResuming(ScreenTransitionEvent e)
@ -330,6 +358,12 @@ public override void OnResuming(ScreenTransitionEvent e)
preloadSongSelect();
musicController.EnsurePlayingSomething();
menuTip.ShowNextTip();
bottomElementsFlow
.ScaleTo(1, 1000, Easing.OutQuint)
.FadeIn(1000, Easing.OutQuint);
}
public override bool OnExiting(ScreenExitEvent e)

View File

@ -0,0 +1,89 @@
// 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;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osuTK;
namespace osu.Game.Screens.Menu
{
public partial class MenuTip : CompositeDrawable
{
[Resolved]
private OsuConfigManager config { get; set; } = null!;
private LinkFlowContainer textFlow = null!;
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
textFlow = new LinkFlowContainer
{
Width = 700,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(0, 2),
},
};
}
public void ShowNextTip()
{
if (!config.Get<bool>(OsuSetting.MenuTips)) return;
static void formatRegular(SpriteText t) => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular);
static void formatSemiBold(SpriteText t) => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold);
string tip = getRandomTip();
AutoSizeAxes = Axes.Both;
textFlow.Clear();
textFlow.AddParagraph("a tip for you:", formatSemiBold);
textFlow.AddParagraph(tip, formatRegular);
this.FadeInFromZero(200, Easing.OutQuint)
.Delay(1000 + 80 * tip.Length)
.Then()
.FadeOutFromOne(2000, Easing.OutQuint)
.Finally(_ => AutoSizeAxes = Axes.X);
}
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)];
}
}
}

View File

@ -31,8 +31,6 @@ public partial class SystemTitle : CompositeDrawable
[BackgroundDependencyLoader]
private void load(OsuGame? game)
{
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
AutoSizeAxes = Axes.Both;
InternalChild = content = new OsuClickableContainer