コード例 #1
0
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 public void CancelCurrentServerListRequest()
 {
     if ((int)this._serverListRequest == 0)
     {
         return;
     }
     Matchmaking.SteamUnityAPI_SteamMatchmakingServers_ReleaseRequest(this._matchmaking, this._serverListRequest);
     this._serverListRequest = 0U;
 }
コード例 #3
0
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
        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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 public void LeaveLobby()
 {
     if (this._lobbyJoined == null)
     {
         return;
     }
     Matchmaking.SteamUnityAPI_SteamMatchmaking_LeaveLobby(this._matchmaking, this._lobbyJoined.SteamID.ToUInt64());
     this._lobbyJoined = (Lobby)null;
 }
コード例 #5
0
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
        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
ファイル: Matchmaking.cs プロジェクト: conankzhang/fez
 internal Matchmaking()
 {
     this._matchmaking        = Matchmaking.SteamUnityAPI_SteamMatchmaking();
     this._matchmakingServers = Matchmaking.SteamUnityAPI_SteamMatchmakingServers();
 }