mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 11:12:54 +08:00
Moved "Does this channel exist" check to ChatLine so that if a #name does not exist as a channel, it does not get added as a link (and does not contain a URL or anything else to prevent jankiness)
This commit is contained in:
parent
18eabd35f6
commit
d90eb2cdce
@ -102,8 +102,9 @@ namespace osu.Game.Overlays.Chat
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, ChatOverlay chat)
|
||||
{
|
||||
this.chat = chat;
|
||||
customUsernameColour = colours.ChatBlue;
|
||||
urlColour = colours.Blue;
|
||||
}
|
||||
@ -204,6 +205,8 @@ namespace osu.Game.Overlays.Chat
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
private ChatOverlay chat;
|
||||
|
||||
private void updateMessageContent()
|
||||
{
|
||||
this.FadeTo(message is LocalEchoMessage ? 0.4f : 1.0f, 500, Easing.OutQuint);
|
||||
@ -232,6 +235,17 @@ namespace osu.Game.Overlays.Chat
|
||||
contentFlow.AddText(message.Content.Substring(prevIndex, link.Index - prevIndex));
|
||||
prevIndex = link.Index + link.Length;
|
||||
|
||||
// If a channel doesn't exist, add it as normal text instead
|
||||
if (link.Url.StartsWith("osu://chan/"))
|
||||
{
|
||||
var channelName = link.Url.Substring(11).Split('/')[0];
|
||||
if (chat.AvailableChannels.TrueForAll(c => c.Name != channelName))
|
||||
{
|
||||
contentFlow.AddText(message.Content.Substring(link.Index, link.Length));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
contentFlow.AddLink(message.Content.Substring(link.Index, link.Length), link.Url, sprite =>
|
||||
{
|
||||
if (message.IsAction)
|
||||
|
Loading…
Reference in New Issue
Block a user