示例#1
0
 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));
 }
示例#2
0
        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()));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        public virtual void OnMessageReceived(LobbyChatPacket msg)
        {
            var text = GetTextObject();

            text.text = GenerateMessageText(msg);
        }
示例#6
0
 public virtual void OnChatMessageReceived(LobbyChatPacket packet)
 {
     Chat.OnMessageReceived(packet);
 }