1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 04:23:21 +08:00

Merge pull request #26182 from peppy/menu-tips

Move menu tips to main menu
This commit is contained in:
Bartłomiej Dach 2023-12-28 10:40:11 +01:00 committed by GitHub
commit 17325ff35b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 170 additions and 36 deletions

View File

@ -96,6 +96,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.MenuVoice, true); SetDefault(OsuSetting.MenuVoice, true);
SetDefault(OsuSetting.MenuMusic, true); SetDefault(OsuSetting.MenuMusic, true);
SetDefault(OsuSetting.MenuTips, true);
SetDefault(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1); SetDefault(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1);
@ -350,6 +351,7 @@ namespace osu.Game.Configuration
VolumeInactive, VolumeInactive,
MenuMusic, MenuMusic,
MenuVoice, MenuVoice,
MenuTips,
CursorRotation, CursorRotation,
MenuParallax, MenuParallax,
Prefer24HourTime, Prefer24HourTime,

View File

@ -24,6 +24,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString MenuCursorSize => new TranslatableString(getKey(@"menu_cursor_size"), @"Menu cursor size"); 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> /// <summary>
/// "Parallax" /// "Parallax"
/// </summary> /// </summary>
@ -154,6 +159,6 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString TrueRandom => new TranslatableString(getKey(@"true_random"), @"True Random"); 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 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsCheckbox
{
LabelText = UserInterfaceStrings.ShowMenuTips,
Current = config.GetBindable<bool>(OsuSetting.MenuTips)
},
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = UserInterfaceStrings.InterfaceVoices, LabelText = UserInterfaceStrings.InterfaceVoices,

View File

@ -12,7 +12,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -122,10 +121,6 @@ namespace osu.Game.Screens.Menu
textFlow.NewParagraph(); textFlow.NewParagraph();
textFlow.NewParagraph(); textFlow.NewParagraph();
textFlow.AddParagraph("today's tip:", formatSemiBold);
textFlow.AddParagraph(getRandomTip(), formatRegular);
textFlow.NewParagraph();
textFlow.NewParagraph(); textFlow.NewParagraph();
iconColour = colours.Yellow; iconColour = colours.Yellow;
@ -228,30 +223,5 @@ namespace osu.Game.Screens.Menu
this.Push(nextScreen); 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

@ -94,7 +94,8 @@ namespace osu.Game.Screens.Menu
private ParallaxContainer buttonsContainer; private ParallaxContainer buttonsContainer;
private SongTicker songTicker; private SongTicker songTicker;
private Container logoTarget; private Container logoTarget;
private SystemTitle systemTitle; private MenuTip menuTip;
private FillFlowContainer bottomElementsFlow;
private Sample reappearSampleSwoosh; private Sample reappearSampleSwoosh;
@ -157,7 +158,27 @@ namespace osu.Game.Screens.Menu
Margin = new MarginPadding { Right = 15, Top = 5 } Margin = new MarginPadding { Right = 15, Top = 5 }
}, },
new KiaiMenuFountains(), new KiaiMenuFountains(),
systemTitle = new SystemTitle(), bottomElementsFlow = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Spacing = new Vector2(5),
Children = new Drawable[]
{
menuTip = new MenuTip
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new SystemTitle
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
}
},
holdToExitGameOverlay?.CreateProxy() ?? Empty() holdToExitGameOverlay?.CreateProxy() ?? Empty()
}); });
@ -272,7 +293,7 @@ namespace osu.Game.Screens.Menu
{ {
base.Update(); base.Update();
systemTitle.Margin = new MarginPadding bottomElementsFlow.Margin = new MarginPadding
{ {
Bottom = (versionManager?.DrawHeight + 5) ?? 0 Bottom = (versionManager?.DrawHeight + 5) ?? 0
}; };
@ -314,6 +335,10 @@ namespace osu.Game.Screens.Menu
buttonsContainer.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine); buttonsContainer.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
sideFlashes.FadeOut(64, Easing.OutQuint); sideFlashes.FadeOut(64, Easing.OutQuint);
bottomElementsFlow
.ScaleTo(0.9f, 1000, Easing.OutQuint)
.FadeOut(500, Easing.OutQuint);
} }
public override void OnResuming(ScreenTransitionEvent e) public override void OnResuming(ScreenTransitionEvent e)
@ -330,6 +355,13 @@ namespace osu.Game.Screens.Menu
preloadSongSelect(); preloadSongSelect();
musicController.EnsurePlayingSomething(); musicController.EnsurePlayingSomething();
// Cycle tip on resuming
menuTip.ShowNextTip();
bottomElementsFlow
.ScaleTo(1, 1000, Easing.OutQuint)
.FadeIn(1000, Easing.OutQuint);
} }
public override bool OnExiting(ScreenExitEvent e) public override bool OnExiting(ScreenExitEvent e)
@ -367,6 +399,10 @@ namespace osu.Game.Screens.Menu
songTicker.Hide(); songTicker.Hide();
this.FadeOut(3000); this.FadeOut(3000);
bottomElementsFlow
.FadeOut(500, Easing.OutQuint);
return base.OnExiting(e); return base.OnExiting(e);
} }

View File

@ -0,0 +1,118 @@
// 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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Menu
{
public partial class MenuTip : CompositeDrawable
{
[Resolved]
private OsuConfigManager config { get; set; } = null!;
private LinkFlowContainer textFlow = null!;
private Bindable<bool> showMenuTips = null!;
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
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,
},
}
},
textFlow = new LinkFlowContainer
{
Width = 600,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.TopCentre,
Spacing = new Vector2(0, 2),
Margin = new MarginPadding(10)
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
showMenuTips = config.GetBindable<bool>(OsuSetting.MenuTips);
showMenuTips.BindValueChanged(_ => ShowNextTip(), true);
}
public void ShowNextTip()
{
if (!showMenuTips.Value)
{
this.FadeOut(100, Easing.OutQuint);
return;
}
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);
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()
.FadeOutFromOne(2000, Easing.OutQuint);
}
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 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGame? game) private void load(OsuGame? game)
{ {
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = content = new OsuClickableContainer InternalChild = content = new OsuClickableContainer