/// <summary> /// Leaves a tournament. /// </summary> /// <param name="id">The tournament identifier.</param> public void LeaveTournament(string id) { if (tournamentCons.TryRemove(id, out LilaTournament t)) { t.Dispose(); if (!lobbyCon.IsConnected()) { lobbyCon.Reconnect(); } } }
/// <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); } } }