Browse Source

Fix black text in chat

pull/8/head
Anton Tarasenko 3 years ago
parent
commit
feebc5aa22
  1. 9
      sources/Chat/ChatAPI.uc

9
sources/Chat/ChatAPI.uc

@ -117,6 +117,15 @@ private function bool HandleText(
messageAsText = __().text.FromColoredStringM(message); messageAsText = __().text.FromColoredStringM(message);
result = onMessageSignal.Emit(senderPlayer, messageAsText, teamMessage); result = onMessageSignal.Emit(senderPlayer, messageAsText, teamMessage);
message = messageAsText.ToColoredString(); message = messageAsText.ToColoredString();
// To correctly display chat messages we want to drop default color tag
// at the beginning (the one `ToColoredString()` adds if first character
// has no defined color).
// This is a compatibility consideration with vanilla UI that expects
// uncolored text. Not removing initial color tag will make chat text
// appear black.
if (!messageAsText.GetFormatting(0).isColored) {
message = Mid(message, 4);
}
_.memory.Free(messageAsText); _.memory.Free(messageAsText);
_.memory.Free(senderPlayer); _.memory.Free(senderPlayer);
return result; return result;

Loading…
Cancel
Save