Пример #1
0
        public void OnConnectionRequest(ConnectionRequest rq)
        {
            try
            {
                string name = rq.Data.GetString(rq.Data.GetInt());
                Guid   uid  = new Guid(rq.Data.GetRemainingBytes());

                //TODO Check validaty

                NetPeer peer = rq.Accept();
                players.Add(peer.Id, new NetPlayer(peer, name, uid));
            } catch (Exception e)
            {
                rq.Reject(Packets.CreateProtocolError("Invalid connection request."));
            }
        }