diff --git a/osu.Game/Users/Drawables/ClickableAvatar.cs b/osu.Game/Users/Drawables/ClickableAvatar.cs index d6c6afba0b..0520f62665 100644 --- a/osu.Game/Users/Drawables/ClickableAvatar.cs +++ b/osu.Game/Users/Drawables/ClickableAvatar.cs @@ -14,13 +14,15 @@ namespace osu.Game.Users.Drawables { public partial class ClickableAvatar : OsuClickableContainer, IHasCustomTooltip { - public ITooltip GetCustomTooltip() => new UserGridPanelTooltip(); + public ITooltip GetCustomTooltip() => new UserGridPanelTooltip(IsTooltipEnabled); public UserGridPanel TooltipContent => new UserGridPanel(user!) { Width = 300 }; + public bool IsTooltipEnabled; + private readonly APIUser? user; [Resolved] @@ -33,6 +35,7 @@ namespace osu.Game.Users.Drawables public ClickableAvatar(APIUser? user = null) { this.user = user; + IsTooltipEnabled = true; if (user?.Id != APIUser.SYSTEM_USER_ID) Action = openProfile; @@ -60,10 +63,21 @@ namespace osu.Game.Users.Drawables private partial class UserGridPanelTooltip : VisibilityContainer, ITooltip { + private readonly bool isEnabled; private UserGridPanel? displayedUser; + public UserGridPanelTooltip(bool isEnabled = true) + { + this.isEnabled = isEnabled; + } + protected override void PopIn() { + if (displayedUser is null || !isEnabled) + { + return; + } + Child = displayedUser; this.FadeIn(20, Easing.OutQuint); } diff --git a/osu.Game/Users/Drawables/UpdateableAvatar.cs b/osu.Game/Users/Drawables/UpdateableAvatar.cs index 3c72d7f7e0..a970997056 100644 --- a/osu.Game/Users/Drawables/UpdateableAvatar.cs +++ b/osu.Game/Users/Drawables/UpdateableAvatar.cs @@ -47,17 +47,20 @@ namespace osu.Game.Users.Drawables private readonly bool isInteractive; private readonly bool showGuestOnNull; + private readonly bool showUserPanel; /// /// Construct a new UpdateableAvatar. /// /// The initial user to display. /// If set to true, hover/click sounds will play and clicking the avatar will open the user's profile. + /// If set to true, the user status panel will be displayed in the tooltip. /// Whether to show a default guest representation on null user (as opposed to nothing). - public UpdateableAvatar(APIUser? user = null, bool isInteractive = true, bool showGuestOnNull = true) + public UpdateableAvatar(APIUser? user = null, bool isInteractive = true, bool showUserPanel = true, bool showGuestOnNull = true) { this.isInteractive = isInteractive; this.showGuestOnNull = showGuestOnNull; + this.showUserPanel = showUserPanel; User = user; }