1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Add tooltips showing current connecting status

This commit is contained in:
Dean Herbert 2022-08-09 15:43:26 +09:00
parent 4da9482a3e
commit 3f8cedff3a
2 changed files with 30 additions and 0 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 ToolbarStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.Toolbar";
/// <summary>
/// "Connection interrupted, will try to reconnect..."
/// </summary>
public static LocalisableString ConnectionInterruptedWillTryTo => new TranslatableString(getKey(@"connection_interrupted_will_try_to"), @"Connection interrupted, will try to reconnect...");
/// <summary>
/// "Connecting..."
/// </summary>
public static LocalisableString Connecting => new TranslatableString(getKey(@"connecting"), @"Connecting...");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -102,12 +102,18 @@ namespace osu.Game.Overlays.Toolbar
switch (state.NewValue) switch (state.NewValue)
{ {
case APIState.Connecting: case APIState.Connecting:
TooltipText = ToolbarStrings.Connecting;
spinner.Show();
break;
case APIState.Failing: case APIState.Failing:
TooltipText = ToolbarStrings.ConnectionInterruptedWillTryTo;
spinner.Show(); spinner.Show();
break; break;
case APIState.Offline: case APIState.Offline:
case APIState.Online: case APIState.Online:
TooltipText = string.Empty;
spinner.Hide(); spinner.Hide();
break; break;