mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
fixed review findings
This commit is contained in:
parent
40d081ee2d
commit
b45d8c785c
@ -78,6 +78,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f),
|
||||
},
|
||||
},
|
||||
new ClickableAvatar(),
|
||||
new ClickableAvatar(),
|
||||
},
|
||||
};
|
||||
});
|
||||
@ -120,6 +122,30 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddWaitStep("wait for tooltip to show", 5);
|
||||
AddStep("Hover out", () => InputManager.MoveMouseTo(new Vector2(0)));
|
||||
AddWaitStep("wait for tooltip to hide", 3);
|
||||
|
||||
AddStep($"click null user {4}. {nameof(ClickableAvatar)}", () =>
|
||||
{
|
||||
var targets = this.ChildrenOfType<ClickableAvatar>().ToList();
|
||||
if (targets.Count < 4)
|
||||
return;
|
||||
|
||||
InputManager.MoveMouseTo(targets[3]);
|
||||
});
|
||||
AddWaitStep("wait for tooltip to show", 5);
|
||||
AddStep("Hover out", () => InputManager.MoveMouseTo(new Vector2(0)));
|
||||
AddWaitStep("wait for tooltip to hide", 3);
|
||||
|
||||
AddStep($"click null user {5}. {nameof(ClickableAvatar)}", () =>
|
||||
{
|
||||
var targets = this.ChildrenOfType<ClickableAvatar>().ToList();
|
||||
if (targets.Count < 5)
|
||||
return;
|
||||
|
||||
InputManager.MoveMouseTo(targets[4]);
|
||||
});
|
||||
AddWaitStep("wait for tooltip to show", 5);
|
||||
AddStep("Hover out", () => InputManager.MoveMouseTo(new Vector2(0)));
|
||||
AddWaitStep("wait for tooltip to hide", 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osuTK;
|
||||
|
||||
@ -21,6 +24,24 @@ namespace osu.Game.Users.Drawables
|
||||
Width = 300
|
||||
};
|
||||
|
||||
public override LocalisableString TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Enabled.Value)
|
||||
return string.Empty;
|
||||
|
||||
return ShowUsernameTooltip ? (user?.Username ?? string.Empty) : ContextMenuStrings.ViewProfile;
|
||||
}
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By default, the tooltip will show "view profile" as avatars are usually displayed next to a username.
|
||||
/// Setting this to <c>true</c> exposes the username via tooltip for special cases where this is not true.
|
||||
/// </summary>
|
||||
public bool ShowUsernameTooltip { get; set; }
|
||||
|
||||
private readonly APIUser? user;
|
||||
|
||||
[Resolved]
|
||||
|
@ -75,6 +75,7 @@ namespace osu.Game.Users.Drawables
|
||||
return new ClickableAvatar(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ShowUsernameTooltip = showUsernameTooltip,
|
||||
};
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user