public void FindGame() { var lobbyList = BoltNetwork.SessionList; foreach (var lobby in lobbyList) { var lobbyToken = SWMatchmaking.GetLobbyToken(lobby.Key); Debug.Log("[LOBBY] Name : " + lobbyToken.ServerName); var lobbyMatchesSelectedServerName = _matchmakingSettings.LookForPrivateGames && lobbyToken.ServerName == _matchmakingSettings.PrivateGameName; Debug.Log("[LOBBY] Matched : " + lobbyMatchesSelectedServerName); var lobbyMatchesSelectedGamemodes = !_matchmakingSettings.LookForPrivateGames && _lobbyData.GamemodePool.Contains(lobbyToken.GameMode); var lobbyMatchesMatchmakingSettings = (!lobbyToken.GameStarted || lobbyToken.GameStarted == _matchmakingSettings.LookForStartedGames); if ((lobbyMatchesSelectedServerName || lobbyMatchesSelectedGamemodes) && lobbyMatchesMatchmakingSettings && lobbyToken.CanBeJoined && lobbyToken.Version.Equals(_lobbyData.Version)) { _lobbyData.SetGamemode(lobbyToken.GameMode); _lobbyData.SetMap(lobbyToken.MapName); SWMatchmaking.JoinLobby ( lobby.Key, new JoinToken() { Nickname = _playerSettings.Nickname } ); } } }
public static void JoinLobby(string serverName, IProtocolToken connectToken = null) { foreach (var session in BoltNetwork.SessionList) { var lobbyToken = SWMatchmaking.GetLobbyToken(session.Key); Debug.Log("Server name : " + lobbyToken.ServerName); if (lobbyToken.ServerName.Equals(serverName)) { BoltNetwork.Connect(BoltNetwork.SessionList[session.Key], connectToken); } } }
public override void SessionListUpdated(Map <Guid, UdpSession> sessionList) { LobbyToken lobbyToken; int matchedLobbyCount = 0; foreach (var lobby in sessionList) { lobbyToken = SWMatchmaking.GetLobbyToken(lobby.Key); if (_lobbyData.GamemodePool.Contains(lobbyToken.GameMode)) { matchedLobbyCount++; } } UpdateCurrentMatchedLobbies(matchedLobbyCount); }