예제 #1
0
        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
                    }
                    );
                }
            }
        }
예제 #2
0
        private IEnumerator JoinBoltLobby(string serverName)
        {
            while (!(BoltNetwork.IsClient && BoltNetwork.SessionList.Count > 0))
            {
                yield return(new WaitForEndOfFrame());
            }
            Debug.Log("[BOLT] Joining lobby ...");
            SWMatchmaking.JoinLobby(serverName, new JoinToken()
            {
                Nickname = _playerSettings.Nickname
            });

            _tinyLobbyPanel.SetActive(true);
        }