Пример #1
0
 public void BroadcastP(IEnumerable <UserHandle> handles, Packets.Packet p)
 {
     if (handles.Any())
     {
         Broadcast?.Invoke(p, handles.Select(x => x.ConnectionID).ToArray());
     }
 }
Пример #2
0
        private void Sender_Send(object sender, Packets.Packet packet)
        {
            NetOutgoingMessage msg = _server.CreateMessage(4);

            packet.Write(msg);
            _server.SendMessage(msg, Connector.GetConnection(packet.Connection), packet.Method.ToNetDeliveryMethod());
        }
Пример #3
0
        public void Send(Packets.Packet i)
        {
            NetOutgoingMessage msg = _client.CreateMessage(4);

            i.Write(msg);
            _client.SendMessage(msg, i.Method.ToNetDeliveryMethod());
        }
Пример #4
0
        public void Connect(string ip, int port, Packets.Packet p)
        {
            NetOutgoingMessage msg = _client.CreateMessage();

            p.Write(msg);
            _client.Connect(ip, port, msg);
        }
Пример #5
0
        private void Sender_Broadcast(Packets.Packet packet, long[] recipients)
        {
            var connections = new System.Collections.Generic.List <NetConnection>(recipients.Length);

            foreach (var rec in recipients)
            {
                var con = Connector.GetConnection(rec);
                if (con != null)
                {
                    connections.Add(con);
                }
            }
            NetOutgoingMessage msg = _server.CreateMessage(4);

            packet.Write(msg);
            _server.SendMessage(msg, connections, packet.Method.ToNetDeliveryMethod(), 0);
        }
Пример #6
0
 public void Send(Packets.Packet p)
 {
     Sent?.Invoke(this, p);
 }
Пример #7
0
 public void Send(Int64 recipient, Packets.Packet p)
 {
     p.Connection = recipient;
     Sent?.Invoke(this, p);
 }
Пример #8
0
 public void Send(UserHandle handle, Packets.Packet p)
 {
     p.Connection = handle.ConnectionID;
     Sent?.Invoke(this, p);
 }