public virtual string GenerateMessageText(LobbyChatPacket packet) { if (packet.IsError) { return(string.Format(ToColoredText("[{0}]: {1}", ErrorColor), packet.Sender, packet.Message)); } return(string.Format("[{0}]: {1}", packet.Sender, packet.Message)); }
public void BroadcastChatMessage(string message, bool isError = false, string sender = "System") { var msg = new LobbyChatPacket() { Message = message, Sender = sender, IsError = isError }; Broadcast(MessageHelper.Create((short)MsfMessageCodes.LobbyChatMessage, msg.ToBytes())); }
public void SendChatMessage(LobbyMember member, string message, bool isError = false, string sender = "System") { var packet = new LobbyChatPacket() { Message = message, Sender = sender, IsError = isError }; var msg = MessageHelper.Create((short)MsfMessageCodes.LobbyChatMessage, packet.ToBytes()); member.Extension.Peer.SendMessage(msg, DeliveryMethod.Reliable); }
public void HandleChatMessage(LobbyMember member, IIncommingMessage message) { var text = message.AsString(); var messagePacket = new LobbyChatPacket() { Message = text, Sender = member.Username }; var msg = MessageHelper.Create((short)MsfMessageCodes.LobbyChatMessage, messagePacket.ToBytes()); Broadcast(msg); }
public virtual void OnMessageReceived(LobbyChatPacket msg) { var text = GetTextObject(); text.text = GenerateMessageText(msg); }
public virtual void OnChatMessageReceived(LobbyChatPacket packet) { Chat.OnMessageReceived(packet); }