1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:03:11 +08:00

Add tooltips and localisation

This commit is contained in:
Dean Herbert 2024-01-17 15:12:33 +09:00
parent e53989faeb
commit 2788bd912e
No known key found for this signature in database
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,24 @@
// 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.Localisation;
namespace osu.Game.Localisation
{
public static class PlayerSettingsOverlayStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.PlaybackSettings";
/// <summary>
/// "Seek backward {0} seconds"
/// </summary>
public static LocalisableString SeekBackwardSeconds(double arg0) => new TranslatableString(getKey(@"seek_backward_seconds"), @"Seek backward {0} seconds", arg0);
/// <summary>
/// "Seek forward {0} seconds"
/// </summary>
public static LocalisableString SeekForwardSeconds(double arg0) => new TranslatableString(getKey(@"seek_forward_seconds"), @"Seek forward {0} seconds", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Timing;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Screens.Play.PlayerSettings
{
@ -71,6 +72,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastBackward,
Action = () => seek(-1, seek_fast_amount),
TooltipText = PlayerSettingsOverlayStrings.SeekBackwardSeconds(seek_fast_amount / 1000),
},
new SeekButton
{
@ -78,6 +80,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Backward,
Action = () => seek(-1, seek_amount),
TooltipText = PlayerSettingsOverlayStrings.SeekBackwardSeconds(seek_amount / 1000),
},
play = new IconButton
{
@ -103,6 +106,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Forward,
Action = () => seek(1, seek_amount),
TooltipText = PlayerSettingsOverlayStrings.SeekForwardSeconds(seek_amount / 1000),
},
new SeekButton
{
@ -110,6 +114,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastForward,
Action = () => seek(1, seek_fast_amount),
TooltipText = PlayerSettingsOverlayStrings.SeekForwardSeconds(seek_fast_amount / 1000),
},
},
},
@ -137,7 +142,19 @@ namespace osu.Game.Screens.Play.PlayerSettings
},
};
isPaused.BindValueChanged(e => play.Icon = !e.NewValue ? FontAwesome.Regular.PauseCircle : FontAwesome.Regular.PlayCircle, true);
isPaused.BindValueChanged(paused =>
{
if (!paused.NewValue)
{
play.TooltipText = ToastStrings.PauseTrack;
play.Icon = FontAwesome.Regular.PauseCircle;
}
else
{
play.TooltipText = ToastStrings.PlayTrack;
play.Icon = FontAwesome.Regular.PlayCircle;
}
}, true);
void seek(int direction, double amount)
{