TextChat Class
Prefab for text chat.
Namespace: Alteruna.Multiplayer.PrefabsAssembly: Alteruna.Doc (in Alteruna.Doc.dll) Version: 1.0.0+a1176e08a0b4a6bfd8fefeddde6163a16d29e5ab
- Inheritance
- Object TextChat

Here we have an example adding a simple command to the text chat.
public class CommandPrintLine : ITextChatCommand
{
public string Command { get; } = "printline";
public string Description { get; } = "print a message to local chat.";
public string Usage { get; } = "/printLine <msg>";
public bool IsCheat { get; } = false;
public bool IgnoreCase { get; } = true;
// Register command
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
public static void Init() => TextChatSynchronizable.Commands.Add(new CommandPrintLine());
public string Execute(TextChatSynchronizable textChat, string[] args)
{
if (args.Length < 0)
{
// Log error to the chat and return an empty response
textChat.LogError("No message");
return null;
}
// Join arguments as a singular string and return it to log it.
return string.Join(" ", args);
}
}