Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move menu tips to main menu #26182

Merged
merged 5 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -350,6 +351,7 @@ public enum OsuSetting
VolumeInactive,
MenuMusic,
MenuVoice,
MenuTips,
CursorRotation,
MenuParallax,
Prefer24HourTime,
Expand Down
7 changes: 6 additions & 1 deletion osu.Game/Localisation/UserInterfaceStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 0 additions & 30 deletions osu.Game/Screens/Menu/Disclaimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)];
}
}
}
42 changes: 39 additions & 3 deletions osu.Game/Screens/Menu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public partial class MainMenu : OsuScreen, IHandlePresentBeatmap, IKeyBindingHan
private ParallaxContainer buttonsContainer;
private SongTicker songTicker;
private Container logoTarget;
private SystemTitle systemTitle;
private MenuTip menuTip;
private FillFlowContainer bottomElementsFlow;

private Sample reappearSampleSwoosh;

Expand Down Expand Up @@ -157,7 +158,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(5),
Children = new Drawable[]
{
menuTip = new MenuTip
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new SystemTitle
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
}
},
holdToExitGameOverlay?.CreateProxy() ?? Empty()
});

Expand Down Expand Up @@ -272,7 +293,7 @@ protected override void Update()
{
base.Update();

systemTitle.Margin = new MarginPadding
bottomElementsFlow.Margin = new MarginPadding
{
Bottom = (versionManager?.DrawHeight + 5) ?? 0
};
Expand Down Expand Up @@ -314,6 +335,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)
Expand All @@ -330,6 +355,13 @@ public override void OnResuming(ScreenTransitionEvent e)
preloadSongSelect();

musicController.EnsurePlayingSomething();

// Cycle tip on resuming
menuTip.ShowNextTip();

bottomElementsFlow
.ScaleTo(1, 1000, Easing.OutQuint)
.FadeIn(1000, Easing.OutQuint);
}

public override bool OnExiting(ScreenExitEvent e)
Expand Down Expand Up @@ -367,6 +399,10 @@ public override bool OnExiting(ScreenExitEvent e)
songTicker.Hide();

this.FadeOut(3000);

bottomElementsFlow
.FadeOut(500, Easing.OutQuint);

return base.OnExiting(e);
}

Expand Down
118 changes: 118 additions & 0 deletions osu.Game/Screens/Menu/MenuTip.cs
Original file line number Diff line number Diff line change
@@ -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)];
}
}
}
2 changes: 0 additions & 2 deletions osu.Game/Screens/Menu/SystemTitle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading