From 37049d41b4850da8c15f5dedc0c7f06a6807be4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 6 Dec 2023 18:25:50 +0100 Subject: [PATCH] Show user's status as tooltip on the extended user panel --- osu.Game/Users/ExtendedUserPanel.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 18fe852556..1359f5d792 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -9,10 +9,12 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users.Drawables; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users @@ -26,7 +28,7 @@ namespace osu.Game.Users protected TextFlowContainer LastVisitMessage { get; private set; } private StatusIcon statusIcon; - private OsuSpriteText statusMessage; + private StatusText statusMessage; protected ExtendedUserPanel(APIUser user) : base(user) @@ -88,7 +90,7 @@ namespace osu.Game.Users } })); - statusContainer.Add(statusMessage = new OsuSpriteText + statusContainer.Add(statusMessage = new StatusText { Anchor = alignment, Origin = alignment, @@ -108,12 +110,14 @@ namespace osu.Game.Users if (activity != null && status != UserStatus.Offline) { statusMessage.Text = activity.GetStatus(); + statusMessage.TooltipText = activity.GetDetails(); statusIcon.FadeColour(activity.GetAppropriateColour(Colours), 500, Easing.OutQuint); return; } // Otherwise use only status statusMessage.Text = status.GetLocalisableDescription(); + statusMessage.TooltipText = string.Empty; statusIcon.FadeColour(status.Value.GetAppropriateColour(Colours), 500, Easing.OutQuint); return; @@ -140,5 +144,10 @@ namespace osu.Game.Users BorderThickness = 0; base.OnHoverLost(e); } + + private partial class StatusText : OsuSpriteText, IHasTooltip + { + public LocalisableString TooltipText { get; set; } + } } }