Example #1
0
    public ChatMessage(ChatMessagePacket pkt)
    {
        var chatComponent = ChatComponent.FromJson(pkt.Json);

        // use .ToString() for plaintext and components will output text with no formatting
        PlaintextMessage = chatComponent.ToString();

        HtmlFormattedMessage = ChatComponent.GetFormattedString(chatComponent, null);
    }
Example #2
0
    public void UpdateEntry(Player player)
    {
        // set display name
        if (player.DisplayName != null)
        {
            DisplayName.text = ChatComponent.GetFormattedString(player.DisplayName, null);
        }
        else
        {
            DisplayName.text = player.Name;
        }

        DisplayName.text += $" {player.Ping.ToString()}ms";
    }