예제 #1
0
파일: Server.cs 프로젝트: MyEyes/Igorr
 public void SendClient(Player player, IgorrMessage message)
 {
     if (!message.Encoded)
     {
         Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString());
         message.Encode();
     }
     foreach (Client client in _clients.Values)
         if (client.PlayerID == player.ID)
             connection.SendMessage(message.GetMessage(), client.Connection, NetDeliveryMethod.ReliableOrdered,currentChannel);
 }
예제 #2
0
파일: Server.cs 프로젝트: MyEyes/Igorr
 public void SendAllMapReliable(IMap map, IgorrMessage message, bool ordered)
 {
     List<NetConnection> recipients = new List<NetConnection>();
     recipients.AddRange(_connections);
     for (int x = 0; x < recipients.Count; x++)
     {
         if (_clients[_clientids[recipients[x].RemoteUniqueIdentifier]].CurrentMap != map)
         {
             recipients.RemoveAt(x);
             x--;
         }
     }
     if (!message.Encoded)
     {
         Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString());
         message.Encode();
     }
     if (recipients.Count > 0)
     {
         if (ordered)
             connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableOrdered, currentChannel);
         else
             connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableUnordered, currentChannel);
     }
 }
예제 #3
0
 public static void SendReliable(IgorrMessage m)
 {
     if (!_enabled)
         return;
     m.Encode();
     if (connection.ServerConnection != null)
             connection.SendMessage(m.GetMessage(), NetDeliveryMethod.ReliableOrdered);
 }
예제 #4
0
파일: Server.cs 프로젝트: MyEyes/Igorr
 public void SendAllExcept(IMap map, Player player, IgorrMessage message, bool Reliable)
 {
     Client client = getClient(player);
     if (_connections.Count > 1)
     {
         List<NetConnection> recipients = new List<NetConnection>();
         recipients.AddRange(_connections);
         if (client != null)
             recipients.Remove(client.Connection);
         for (int x = 0; x < recipients.Count; x++)
         {
             if (_clients[_clientids[recipients[x].RemoteUniqueIdentifier]].CurrentMap != map)
             {
                 recipients.RemoveAt(x);
                 x--;
             }
         }
         if (!message.Encoded)
         {
             Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString());
             message.Encode();
         }
         if (recipients.Count > 0 && Reliable)
             connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableOrdered, currentChannel);
         else if (recipients.Count > 0 && !Reliable && !_enableSend)
             connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.Unreliable, currentChannel);
     }
 }
예제 #5
0
 public static void Send(IgorrMessage message, bool Sequenced)
 {
     if (!_enabled)
         return;
     message.Encode();
     if (connection.ServerConnection != null)
         if (!Sequenced)
             connection.SendMessage(message.GetMessage(), NetDeliveryMethod.Unreliable);
         else
             connection.SendMessage(message.GetMessage(), NetDeliveryMethod.UnreliableSequenced);
         //ProtocolHelper.Send(message, connection.ServerConnection);
 }