Exemplo n.º 1
0
        /// <summary>
        /// Called when a challenge is reloaded.
        /// </summary>
        /// <param name="ws">The websocket.</param>
        /// <param name="message">The message.</param>
        private void OnChallengeReload(WebSocketBase ws, MReload message)
        {
            if (_disposing)
            {
                return;
            }

            if (challengeCon != null && challengeCon.IsConnected())
            {
                //Disconnect challenge socket
                log.ConditionalDebug("Disconnecting challenge socket.");
                challengeCon.DisconnectAsync().Wait();
            }

            if (challengeLocation != null)
            {
                Task <Round> roundTask = GetRound(challengeLocation);
                roundTask.Wait();

                Round round = roundTask.Result;
                if (round != null)
                {
                    if (gameCons.TryGetValue(round.Game.Url.Socket, out LilaGame gameCon))
                    {
                        return;
                    }

                    JoinGame(round.Game);
                }
            }
        }