1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Show user's status as tooltip on the extended user panel

This commit is contained in:
Bartłomiej Dach 2023-12-06 18:25:50 +01:00
parent 86e003aec1
commit 37049d41b4
No known key found for this signature in database

View File

@ -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; }
}
}
}