Use common AddUserLink method

This commit is contained in:
smoogipoo
2019-04-05 14:15:36 +09:00
parent a6bf076dc7
commit 15fbb6f176
6 changed files with 10 additions and 12 deletions

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Users;
namespace osu.Game.Graphics.Containers
{
@ -75,6 +76,9 @@ namespace osu.Game.Graphics.Containers
return createLink(text, null, url, linkType, linkArgument, tooltipText);
}
public IEnumerable<Drawable> AddUserLink(User user, Action<SpriteText> creationParameters = null)
=> createLink(AddText(user.Username, creationParameters), user.Username, null, LinkAction.OpenUserProfile, user.Id.ToString(), "View profile");
private IEnumerable<Drawable> createLink(IEnumerable<Drawable> drawables, string text, string url = null, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action action = null)
{
AddInternal(new DrawableLinkCompiler(drawables.OfType<SpriteText>().ToList())