mirror of https://github.com/ppy/osu
Handle links in message
This commit is contained in:
parent
7cd3f5656d
commit
a81d5cd819
|
@ -14,6 +14,7 @@
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments
|
||||||
{
|
{
|
||||||
|
@ -35,7 +36,7 @@ public DrawableComment(Comment comment)
|
||||||
LinkFlowContainer username;
|
LinkFlowContainer username;
|
||||||
FillFlowContainer childCommentsContainer;
|
FillFlowContainer childCommentsContainer;
|
||||||
FillFlowContainer info;
|
FillFlowContainer info;
|
||||||
TextFlowContainer message;
|
LinkFlowContainer message;
|
||||||
GridContainer content;
|
GridContainer content;
|
||||||
VotePill votePill;
|
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,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
@ -193,7 +194,10 @@ public DrawableComment(Comment comment)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!comment.IsDeleted)
|
if (!comment.IsDeleted)
|
||||||
message.Text = comment.GetMessage();
|
{
|
||||||
|
var formattedSource = MessageFormatter.FormatText(comment.GetMessage());
|
||||||
|
message.AddLinks(formattedSource.Text, formattedSource.Links);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
content.FadeColour(OsuColour.Gray(0.5f));
|
content.FadeColour(OsuColour.Gray(0.5f));
|
||||||
|
|
Loading…
Reference in New Issue