TextChat Class

Prefab for text chat.

Definition

Namespace: Alteruna.Prefabs
Assembly: Alteruna.Doc (in Alteruna.Doc.dll) Version: 1.0.0
C#
public class TextChat
Inheritance
Object    TextChat

Remarks

Example

Here we have an example adding a simple command to the text chat.
C#
public class CommandSay : ITextChatCommand
{
    public string Command { get; } = "helloworld";
    public string Description { get; } = "print a message to local chat.";
    public string Usage { get; } = "/helloWorld <msg>";
    public bool IsCheat { get; } = false;
    public bool IgnoreCase { get; } = true;

    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
    public static void Init() =< TextChatSynchronizable.Commands.Add(new CommandSay());

    public string Execute(TextChatSynchronizable textChat, string[] args)
    {
        if (args.Length < 0)
        {
            textChat.LogError("No message");
            return null;
        }

        return string.Join(" ", args);
    }
}

Properties

ChatBuffer Change max number of buffered chat lines

Methods

SendChatMessage Send a chat message.

Fields

AllowCheats Allow cheats in the chat default state.
AllowCommands Allow commands in the chat.
AllowHostToToggleCheats Allow a host to enable cheats.
BoldNames Make the names bold in the chat.
GetUserColor Function for getting the user color from user id.
LogErrors Log Unity errors in the chat.
LogLocalOnSend Log local messages when being sent.
LogSystemMessages Log system messages in the chat.
TextChatUpdate Text updated event.
UseRichText Use rich text in the chat.
UseTimeStamps Sort messages based on senders timestamp.

See Also