コード例 #1
0
ファイル: LilaGame.cs プロジェクト: arbitre125/LilaSharp
 /// <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
ファイル: LilaClient.cs プロジェクト: arbitre125/LilaSharp
        /// <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));
            }
        }