public static string buildMessage(string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal) { string colorPrefix = "<color=" + colour.ToString() + ">"; string colorSuffix = "</color>"; string stylePrefix, styleSuffix; switch (style) { case ChatStyle.bold: stylePrefix = "<b>"; styleSuffix = "</b>"; break; case ChatStyle.bolditalic: stylePrefix = "<b><i>"; styleSuffix = "</i></b>"; break; case ChatStyle.italic: stylePrefix = "<i>"; styleSuffix = "</i>"; break; default: stylePrefix = ""; styleSuffix = ""; break; } return(stylePrefix + colorPrefix + message + colorSuffix + styleSuffix); }
public static void sendAllSilent(string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server) { ChatSenderType type = ChatSenderType.Server; string messageBuilt = buildMessage(message, colour, style); using (ByteBuilder byteBuilder = ByteBuilder.Get()) { byteBuilder.Write((ushort)ClientMessageType.Chat); byteBuilder.Write((byte)type); byteBuilder.Write(messageBuilt); Players.SendToAll(byteBuilder.ToArray(), NetworkMessageReliability.ReliableWithBuffering); } }
public static void sendSilent(Players.Player player, string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server) { ChatSenderType type = ChatSenderType.Server; if (!(player.ID == NetworkID.Server)) { string messageBuilt = buildMessage(message, colour, style); using (ByteBuilder byteBuilder = ByteBuilder.Get()) { byteBuilder.Write((ushort)ClientMessageType.Chat); byteBuilder.Write((byte)type); byteBuilder.Write(messageBuilt); NetworkWrapper.Send(byteBuilder.ToArray(), player, NetworkMessageReliability.ReliableWithBuffering); } } //send(player, message, colour, style, sender); }
public static void sendToAllBut(Players.Player n, string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server) { string messageBuilt = buildMessage(message, colour, style); Pipliz.Chatting.Chat.SendToAllBut(n, messageBuilt, sender); }
public TalkPacket(ChatType type, string words, ChatColour colour) : this(Constants.SYSTEM_NAME, Constants.ALLUSERS_NAME, words, string.Empty, (uint)colour, type) { }
public static void SendToAllSilent(string message, ChatColour chatColour = ChatColour.white, ChatStyle chatStyle = ChatStyle.normal) { string messageBuild = BuildMessage(message, chatColour, chatStyle); Chatting.Chat.SendToConnected(messageBuild, Chatting.EChatSendOptions.None); }
public static void SendSilent(Players.Player player, string message, ChatColour chatColour = ChatColour.white, ChatStyle chatStyle = ChatStyle.normal) { string messageBuild = BuildMessage(message, chatColour, chatStyle); Chatting.Chat.Send(player, messageBuild, Chatting.EChatSendOptions.None); }
public static void SendToAllBut(Players.Player player, string message, ChatColour chatColour = ChatColour.white, ChatStyle chatStyle = ChatStyle.normal) { string messageBuild = BuildMessage(message, chatColour, chatStyle); Chatting.Chat.SendToConnectedBut(player, messageBuild); }
public static void SendToAll(string message, ChatColour chatColour = ChatColour.white, ChatStyle chatStyle = ChatStyle.normal) { string messageBuild = BuildMessage(message, chatColour, chatStyle); Chatting.Chat.SendToConnected(messageBuild); }