Example #1
0
 public void SendMessageToAll(string nickname, string message)
 {
     if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(message))
     {
         PacketInfo packetInfoMessage = new PacketInfo("Message");
         MessageInfo messageInfo = new MessageInfo(message);
         messageInfo.FromUser = new UserInfo(nickname);
         packetInfoMessage.Data = messageInfo;
         SendToAll(packetInfoMessage);
     }
 }
Example #2
0
 public void SendMessage(string message, string toUser, Color color)
 {
     if (!string.IsNullOrEmpty(message))
     {
         PacketInfo packetInfo = new PacketInfo("Message");
         MessageInfo messageInfo = new MessageInfo(message);
         if (!string.IsNullOrEmpty(toUser)) messageInfo.ToUser = new UserInfo(toUser);
         messageInfo.TextColor = color;
         packetInfo.Data = messageInfo;
         client.SendPacket(packetInfo);
     }
 }
Example #3
0
 protected void OnMessageReceived(MessageInfo messageInfo)
 {
     if (MessageReceived != null)
     {
         MessageReceived(messageInfo);
     }
 }
Example #4
0
        private void client_MessageReceived(MessageInfo messageInfo)
        {
            string user;

            if (messageInfo.ToUser != null && !string.IsNullOrEmpty(messageInfo.ToUser.Nickname))
            {
                user = string.Format("{0} > {1}", messageInfo.FromUser.Nickname, messageInfo.ToUser.Nickname);
            }
            else
            {
                user = messageInfo.FromUser.Nickname;
            }

            AddClientMessage(user, messageInfo.Text, messageInfo.TextColor);
        }