Handle links in message

This commit is contained in:
Andrei Zavatski 2019-10-14 16:56:07 +03:00
parent 7cd3f5656d
commit a81d5cd819
1 changed files with 7 additions and 3 deletions

View File

@ -14,6 +14,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using System.Linq;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Comments
{
@ -35,7 +36,7 @@ public DrawableComment(Comment comment)
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
FillFlowContainer info;
TextFlowContainer message;
LinkFlowContainer message;
GridContainer content;
VotePill votePill;
@ -119,7 +120,7 @@ public DrawableComment(Comment comment)
}
}
},
message = new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@ -193,7 +194,10 @@ public DrawableComment(Comment comment)
}
if (!comment.IsDeleted)
message.Text = comment.GetMessage();
{
var formattedSource = MessageFormatter.FormatText(comment.GetMessage());
message.AddLinks(formattedSource.Text, formattedSource.Links);
}
else
{
content.FadeColour(OsuColour.Gray(0.5f));