mirror of
https://github.com/osukey/osukey.git
synced 2025-06-10 05:48:05 +09: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)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, ChatOverlay chat)
|
||||||
{
|
{
|
||||||
|
this.chat = chat;
|
||||||
customUsernameColour = colours.ChatBlue;
|
customUsernameColour = colours.ChatBlue;
|
||||||
urlColour = colours.Blue;
|
urlColour = colours.Blue;
|
||||||
}
|
}
|
||||||
@ -204,6 +205,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
FinishTransforms(true);
|
FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChatOverlay chat;
|
||||||
|
|
||||||
private void updateMessageContent()
|
private void updateMessageContent()
|
||||||
{
|
{
|
||||||
this.FadeTo(message is LocalEchoMessage ? 0.4f : 1.0f, 500, Easing.OutQuint);
|
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));
|
contentFlow.AddText(message.Content.Substring(prevIndex, link.Index - prevIndex));
|
||||||
prevIndex = link.Index + link.Length;
|
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 =>
|
contentFlow.AddLink(message.Content.Substring(link.Index, link.Length), link.Url, sprite =>
|
||||||
{
|
{
|
||||||
if (message.IsAction)
|
if (message.IsAction)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user