Changed chat link implementation according to review

This commit is contained in:
FreezyLemon
2017-12-31 00:51:47 +01:00
parent d66d741af2
commit e7721d71f3
14 changed files with 272 additions and 281 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Profile
public class ProfileHeader : Container
{
private readonly OsuTextFlowContainer infoTextLeft;
private readonly OsuLinkFlowContainer infoTextRight;
private readonly LinkFlowContainer infoTextRight;
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
private readonly RankGraph rankGraph;
@ -142,7 +142,7 @@ namespace osu.Game.Overlays.Profile
ParagraphSpacing = 0.8f,
LineSpacing = 0.2f
},
infoTextRight = new OsuLinkFlowContainer(t =>
infoTextRight = new LinkFlowContainer(t =>
{
t.TextSize = 14;
t.Font = @"Exo2.0-RegularItalic";
@ -473,6 +473,20 @@ namespace osu.Game.Overlays.Profile
}
}
private class LinkFlowContainer : OsuTextFlowContainer
{
public override bool HandleInput => true;
public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null)
: base(defaultCreationParameters)
{
}
protected override SpriteText CreateSpriteText() => new OsuSpriteLink();
public void AddLink(string text, string url) => AddText(text, sprite => ((OsuSpriteLink)sprite).Url = url);
}
private class ProfileLink : OsuSpriteLink, IHasTooltip
{
public string TooltipText => "View Profile in Browser";