예제 #1
0
 /// <summary>
 /// Plays a move.
 /// </summary>
 /// <param name="move">The move.</param>
 public void PlayMove(PData <PMove> move)
 {
     if (socket != null)
     {
         socket.Send(move);
     }
 }
예제 #2
0
 /// <summary>
 /// Sends a ping.
 /// </summary>
 public void SendPing()
 {
     if (socket != null)
     {
         socket.Send(tournamentPing);
     }
 }
예제 #3
0
        /// <summary>
        /// Connects the lobby internally
        /// </summary>
        private void ConnectLobbyInternal()
        {
            if (_disposing)
            {
                return;
            }

            Uri host     = new Uri("wss://socket.lichess.org");
            Uri relative = new Uri(LilaRoutes.LobbySocket, UriKind.Relative);
            Uri absolute = new Uri(host, relative);

            UriBuilder lobbyBldr = new UriBuilder(absolute)
            {
                Query = string.Format("sri={0}", LobbySri = random.NextSri())
            };

            //int port = LilaPing.PingServer(9025, 9029, 1);
            //lobbyBldr.Port = port == -1 ? 9025 : port;

            if (lobbyCon != null && lobbyCon.Connect(lobbyBldr.Uri))
            {
                Events.FireEventAsync(Events._onConnect, new ConnectEvent(this));

                lobbyCon.Send(new PHookIn());
                lobbyCon.Send(new PServerLatency(true));
            }
        }