예제 #1
0
 public Servers RequestLANServerList(OnServerReceived onServerReceived, OnServerListReceived onServerListReceived)
 {
     string[] keys;
     string[] values;
     this.PrepServerListRequest((Dictionary <string, string>)null, onServerReceived, onServerListReceived, out keys, out values);
     this._serverListRequest = Matchmaking.SteamUnityAPI_SteamMatchmakingServers_RequestLANServerList(this._matchmakingServers, Matchmaking.SteamUnityAPI_SteamUtils_GetAppID(), Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerReceivedFromSteam), Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerListReceivedFromSteam));
     return(this._serverList);
 }
예제 #2
0
 public void CancelCurrentServerListRequest()
 {
     if ((int)this._serverListRequest == 0)
     {
         return;
     }
     Matchmaking.SteamUnityAPI_SteamMatchmakingServers_ReleaseRequest(this._matchmaking, this._serverListRequest);
     this._serverListRequest = 0U;
 }
예제 #3
0
        public Servers RequestFriendServerList(Dictionary <string, string> filters, OnServerReceived onServerReceived, OnServerListReceived onServerListReceived)
        {
            string[] keys;
            string[] values;
            this.PrepServerListRequest(filters, onServerReceived, onServerListReceived, out keys, out values);
            this._serverListRequest = this._serverFilters == null?Matchmaking.SteamUnityAPI_SteamMatchmakingServers_RequestFriendServerList(this._matchmakingServers, Matchmaking.SteamUnityAPI_SteamUtils_GetAppID(), (string[])null, (string[])null, 0U, Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerReceivedFromSteam), Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerListReceivedFromSteam)) : Matchmaking.SteamUnityAPI_SteamMatchmakingServers_RequestFriendServerList(this._matchmakingServers, Matchmaking.SteamUnityAPI_SteamUtils_GetAppID(), keys, values, (uint)this._serverFilters.Count, Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerReceivedFromSteam), Marshal.GetFunctionPointerForDelegate((Delegate)this._onServerListReceivedFromSteam));

            return(this._serverList);
        }
예제 #4
0
 public void LeaveLobby()
 {
     if (this._lobbyJoined == null)
     {
         return;
     }
     Matchmaking.SteamUnityAPI_SteamMatchmaking_LeaveLobby(this._matchmaking, this._lobbyJoined.SteamID.ToUInt64());
     this._lobbyJoined = (Lobby)null;
 }
예제 #5
0
 public void CreateLobby(ELobbyType lobbyType, int maxMembers, OnLobbyCreated onLobbyCreated)
 {
     if (CommunityExpress.Instance.IsGameServerInitialized)
     {
         throw new Exception("A Lobby cannot be created after a Steam Game Server has been initialized.");
     }
     this._onLobbyCreated = onLobbyCreated;
     CommunityExpress.Instance.AddCreateLobbyCallback(Matchmaking.SteamUnityAPI_SteamMatchmaking_CreateLobby(this._matchmaking, lobbyType, maxMembers), new OnMatchmakingLobbyCreatedBySteam(this.OnLobbyCreatedCallback));
 }
예제 #6
0
 public void JoinLobby(Lobby lobby, OnLobbyJoined onLobbyJoined)
 {
     if (this._lobbyJoined != null)
     {
         this.LeaveLobby();
     }
     this._lobbyJoined   = lobby;
     this._onLobbyJoined = onLobbyJoined;
     CommunityExpress.Instance.AddLobbyJoinedCallback(Matchmaking.SteamUnityAPI_SteamMatchmaking_JoinLobby(this._matchmaking, lobby.SteamID.ToUInt64()), new OnMatchmakingLobbyJoinedFromSteam(this.OnLobbyJoinedCallback));
 }
예제 #7
0
 public void JoinLobby(SteamID steamIDLobby, OnLobbyJoined onLobbyJoined)
 {
     if (this._lobbyJoined != null)
     {
         this.LeaveLobby();
     }
     foreach (Lobby lobby in this._lobbyList)
     {
         if (lobby.SteamID == steamIDLobby)
         {
             this._lobbyJoined = lobby;
             break;
         }
     }
     this._onLobbyJoined = onLobbyJoined;
     CommunityExpress.Instance.AddLobbyJoinedCallback(Matchmaking.SteamUnityAPI_SteamMatchmaking_JoinLobby(this._matchmaking, steamIDLobby.ToUInt64()), new OnMatchmakingLobbyJoinedFromSteam(this.OnLobbyJoinedCallback));
 }
예제 #8
0
 public void RequestLobbyList(ICollection <LobbyStringFilter> stringFilters, ICollection <LobbyIntFilter> intFilters, Dictionary <string, int> nearValueFilters, int requiredSlotsAvailable, ELobbyDistanceFilter lobbyDistance, int maxResults, ICollection <SteamID> compatibleSteamIDs, OnLobbyListReceived onLobbyListReceived)
 {
     if ((long)this._lobbyListRequest != 0L)
     {
         this.CancelCurrentLobbyListRequest();
     }
     this._onLobbyListReceived = onLobbyListReceived;
     if (stringFilters != null)
     {
         foreach (LobbyStringFilter lobbyStringFilter in (IEnumerable <LobbyStringFilter>)stringFilters)
         {
             Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListStringFilter(this._matchmaking, lobbyStringFilter.key, lobbyStringFilter.value, lobbyStringFilter.comparison);
         }
     }
     if (intFilters != null)
     {
         foreach (LobbyIntFilter lobbyIntFilter in (IEnumerable <LobbyIntFilter>)intFilters)
         {
             Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListNumericalFilter(this._matchmaking, lobbyIntFilter.key, lobbyIntFilter.value, lobbyIntFilter.comparison);
         }
     }
     if (nearValueFilters != null)
     {
         foreach (KeyValuePair <string, int> keyValuePair in nearValueFilters)
         {
             Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListNearValueFilter(this._matchmaking, keyValuePair.Key, keyValuePair.Value);
         }
     }
     if (compatibleSteamIDs != null)
     {
         foreach (SteamID steamId in (IEnumerable <SteamID>)compatibleSteamIDs)
         {
             Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(this._matchmaking, steamId.ToUInt64());
         }
     }
     if (requiredSlotsAvailable != 0)
     {
         Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable(this._matchmaking, requiredSlotsAvailable);
     }
     if (maxResults != 0)
     {
         Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListResultCountFilter(this._matchmaking, maxResults);
     }
     Matchmaking.SteamUnityAPI_SteamMatchmaking_AddRequestLobbyListDistanceFilter(this._matchmaking, lobbyDistance);
     CommunityExpress.Instance.AddLobbyListRequestCallback(Matchmaking.SteamUnityAPI_SteamMatchmaking_RequestLobbyList(this._matchmaking), new OnMatchmakingLobbyListReceivedFromSteam(this.OnLobbyListReceivedCallback));
 }
예제 #9
0
        private void OnLobbyListReceivedCallback(ref LobbyMatchList_t callbackData)
        {
            Lobbies lobbies = new Lobbies();

            for (int lobbyIndex = 0; (long)lobbyIndex < (long)callbackData.m_nLobbiesMatching; ++lobbyIndex)
            {
                ulong lobbyByIndex = Matchmaking.SteamUnityAPI_SteamMatchmaking_GetLobbyByIndex(this._matchmaking, lobbyIndex);
                Lobby lobby1       = (Lobby)null;
                foreach (Lobby lobby2 in this._lobbyList)
                {
                    if (lobby2.SteamID == lobbyByIndex)
                    {
                        lobby1 = lobby2;
                        break;
                    }
                }
                if (lobby1 == null)
                {
                    lobby1 = new Lobby(this._lobbyList, new SteamID(lobbyByIndex));
                }
                lobbies.Add(lobby1);
            }
            this._onLobbyListReceived(lobbies);
        }
예제 #10
0
 internal Matchmaking()
 {
     this._matchmaking        = Matchmaking.SteamUnityAPI_SteamMatchmaking();
     this._matchmakingServers = Matchmaking.SteamUnityAPI_SteamMatchmakingServers();
 }