diff --git a/osu.Game/Online/Chat/ChatLinkSpriteText.cs b/osu.Game/Online/Chat/ChatLinkSpriteText.cs index a1856af6b0..560579a007 100644 --- a/osu.Game/Online/Chat/ChatLinkSpriteText.cs +++ b/osu.Game/Online/Chat/ChatLinkSpriteText.cs @@ -18,13 +18,15 @@ namespace osu.Game.Online.Chat { public class ChatLinkSpriteText : OsuLinkSpriteText { + public int LinkId; + private Color4 hoverColour; private Color4 urlColour; protected override bool OnHover(InputState state) { // Every word is one sprite in chat (for word wrap) so we need to find all other sprites that display the same link - var otherSpritesWithSameLink = ((Container)Parent).Children.Where(child => (child as OsuLinkSpriteText)?.Url == Url && !Equals(child)); + var otherSpritesWithSameLink = ((Container)Parent).Children.Where(child => (child as ChatLinkSpriteText)?.LinkId == LinkId && !Equals(child)); var hoverResult = base.OnHover(state); @@ -39,7 +41,7 @@ namespace osu.Game.Online.Chat protected override void OnHoverLost(InputState state) { - var spritesWithSameLink = ((Container)Parent).Children.Where(child => (child as OsuLinkSpriteText)?.Url == Url); + var spritesWithSameLink = ((Container)Parent).Children.Where(child => (child as ChatLinkSpriteText)?.LinkId == LinkId); if (spritesWithSameLink.Any(sprite => sprite.IsHovered)) { diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 0e1d383f2a..3ebf5cf513 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -237,6 +237,8 @@ namespace osu.Game.Overlays.Chat if (message.IsAction) sprite.Font = @"Exo2.0-MediumItalic"; sprite.Colour = urlColour; + // We want to use something that is unique to every formatted link, so I just use the position of the link + ((ChatLinkSpriteText)sprite).LinkId = prevIndex; }); }