Esempio n. 1
0
 public void Broadcast(byte channelID, ref Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     Native.enet_host_broadcast(_host, channelID, packet.NativeData);
     packet.NativeData = null; // Broadcast automatically clears this.
 }
Esempio n. 2
0
        public void Broadcast(byte channelID, ref Packet packet, Peer[] peers)
        {
            CheckCreated();

            packet.CheckCreated();

            if (peers.Length > 0)
            {
                IntPtr[] nativePeers = ArrayPool.GetPointerBuffer();
                int      nativeCount = 0;

                for (int i = 0; i < peers.Length; i++)
                {
                    if (peers[i].NativeData != IntPtr.Zero)
                    {
                        nativePeers[nativeCount] = peers[i].NativeData;
                        nativeCount++;
                    }
                }

                Native.enet_host_broadcast_selective(nativeHost, channelID, packet.NativeData, nativePeers, (IntPtr)nativeCount);
            }

            packet.NativeData = IntPtr.Zero;
        }
Esempio n. 3
0
 public void Broadcast(byte channelID, ref Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     Native.enet_host_broadcast(_host, channelID, packet.NativeData);
     packet.NativeData = null; // Broadcast automatically clears this.
 }
Esempio n. 4
0
 public void Broadcast(byte channelID, ref Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     _host.Broadcast(channelID, packet.NativeData);
     packet.NativeData = null;
 }
Esempio n. 5
0
        public bool Send(byte channelID, ref Packet packet)
        {
            CheckCreated();

            packet.CheckCreated();

            return(Native.enet_peer_send(nativePeer, channelID, packet.NativeData) == 0);
        }
Esempio n. 6
0
        public void Broadcast(byte channelID, ref Packet packet, Peer excludedPeer)
        {
            CheckCreated();

            packet.CheckCreated();
            Native.enet_host_broadcast_exclude(nativeHost, channelID, packet.NativeData, excludedPeer.NativeData);
            packet.NativeData = IntPtr.Zero;
        }
Esempio n. 7
0
        // Added by Coburn. This version returns either 0 if the send was successful,
        // or the ENET return code if not. Sometimes a bool is not enough to determine
        // the root cause of the issue.
        public int SendAndReturnStatusCode(byte channelID, ref Packet packet)
        {
            CheckCreated();

            packet.CheckCreated();

            return(Native.enet_peer_send(nativePeer, channelID, packet.NativeData));
        }
Esempio n. 8
0
 public bool Send(byte channelID, Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     return Native.enet_peer_send(_peer, channelID, packet.NativeData) >= 0;
 }
Esempio n. 9
0
 public bool Send(byte channelID, Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     return Native.enet_peer_send(_peer, channelID, packet.NativeData) >= 0;
 }
Esempio n. 10
0
 public bool Send(byte channelID, Packet packet)
 {
     CheckCreated();
     packet.CheckCreated();
     return(_peer.Send(channelID, packet.NativeData) >= 0);
 }