mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
added isEnabled to tooltip
This commit is contained in:
parent
718492a0b7
commit
034f53da4b
@ -14,13 +14,15 @@ namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public partial class ClickableAvatar : OsuClickableContainer, IHasCustomTooltip<UserGridPanel>
|
||||
{
|
||||
public ITooltip<UserGridPanel> GetCustomTooltip() => new UserGridPanelTooltip();
|
||||
public ITooltip<UserGridPanel> 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<UserGridPanel>
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -47,17 +47,20 @@ namespace osu.Game.Users.Drawables
|
||||
|
||||
private readonly bool isInteractive;
|
||||
private readonly bool showGuestOnNull;
|
||||
private readonly bool showUserPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new UpdateableAvatar.
|
||||
/// </summary>
|
||||
/// <param name="user">The initial user to display.</param>
|
||||
/// <param name="isInteractive">If set to true, hover/click sounds will play and clicking the avatar will open the user's profile.</param>
|
||||
/// <param name="showUserPanel">If set to true, the user status panel will be displayed in the tooltip.</param>
|
||||
/// <param name="showGuestOnNull">Whether to show a default guest representation on null user (as opposed to nothing).</param>
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user