Beispiel #1
0
        public override bool ServerDisconnect(int connectionId)
        {
            if (Server == null)
            {
                Debug.LogError("Server object is null, this shouldn't really happen but it did...");
                return(false);
            }

            IgnoranceCommandPacket kickPacket = new IgnoranceCommandPacket
            {
                Type   = IgnoranceCommandType.ServerKickPeer,
                PeerId = (uint)connectionId - 1 // ENet's native peer ID will be ConnID - 1
            };

            Server.Commands.Enqueue(kickPacket);

            return(true);
        }
Beispiel #2
0
        public override void ServerDisconnect(int connectionId)
        {
            if (Server == null)
            {
                Debug.LogError("Cannot enqueue kick packet; our Server object is null. Something has gone wrong.");
                // Return here because otherwise we will get a NRE when trying to enqueue the kick packet.
                return;
            }

            IgnoranceCommandPacket kickPacket = new IgnoranceCommandPacket
            {
                Type   = IgnoranceCommandType.ServerKickPeer,
                PeerId = (uint)connectionId - 1 // ENet's native peer ID will be ConnID - 1
            };

            // Pass the packet onto the thread for dispatch.
            Server.Commands.Enqueue(kickPacket);
        }