Пример #1
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);
        }
Пример #2
0
 public void RunCallbacks()
 {
   CommunityExpress.SteamUnityAPI_RunCallbacks();
   if (this._gameserver != null && this._gameserver.IsInitialized)
   {
     CommunityExpress.SteamUnityAPI_SteamGameServer_RunCallbacks();
     for (int index = 0; index < this._gameserverUserStatsReceivedCallHandles.Count; ++index)
     {
       ulong callHandle = this._gameserverUserStatsReceivedCallHandles[index];
       byte failed;
       if (CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(callHandle, out failed))
       {
         GSStatsReceived_t result = new GSStatsReceived_t();
         UserStatsReceived_t CallbackData = new UserStatsReceived_t();
         CommunityExpress.SteamUnityAPI_SteamUtils_GetGameServerUserStatsReceivedResult(callHandle, out result, out failed);
         CallbackData.m_nGameID = (ulong) CommunityExpress.SteamUnityAPI_SteamUtils_GetAppID();
         CallbackData.m_steamIDUser = result.m_steamIDUser;
         CallbackData.m_eResult = result.m_eResult;
         this._gameserverUserStatsReceivedCallbacks[index](ref CallbackData);
         this._gameserverUserStatsReceivedCallHandles.RemoveAt(index);
         this._gameserverUserStatsReceivedCallbacks.RemoveAt(index);
         --index;
       }
     }
   }
   if (this._networking != null && this._networking.IsInitialized)
     this._networking.CheckForNewP2PPackets();
   byte failed1;
   if ((long) this._userGetEncryptedAppTicketCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._userGetEncryptedAppTicketCallHandle, out failed1))
   {
     this._userGetEncryptedAppTicketCallback();
     this._userGetEncryptedAppTicketCallHandle = 0UL;
   }
   byte failed2;
   if ((long) this._lobbyCreatedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyCreatedCallHandle, out failed2))
   {
     LobbyCreated_t result = new LobbyCreated_t();
     CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyCreatedResult(this._lobbyCreatedCallHandle, out result, out failed2);
     this._lobbyCreatedCallback(ref result);
     this._lobbyCreatedCallHandle = 0UL;
   }
   byte failed3;
   if ((long) this._lobbyListReceivedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyListReceivedCallHandle, out failed3))
   {
     LobbyMatchList_t result = new LobbyMatchList_t();
     CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyListReceivedResult(this._lobbyListReceivedCallHandle, out result, out failed3);
     this._lobbyListReceivedCallback(ref result);
     this._lobbyListReceivedCallHandle = 0UL;
   }
   byte failed4;
   if ((long) this._lobbyJoinedCallHandle == 0L || !CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyJoinedCallHandle, out failed4))
     return;
   LobbyEnter_t result1 = new LobbyEnter_t();
   CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyEnteredResult(this._lobbyJoinedCallHandle, out result1, out failed4);
   this._lobbyJoinedCallback(ref result1);
   this._lobbyJoinedCallHandle = 0UL;
 }
Пример #3
0
 private static bool SteamUnityAPI_SteamUtils_GetLobbyListReceivedResult(ulong callHandle, out LobbyMatchList_t result, out byte failed);
Пример #4
0
        public void RunCallbacks()
        {
            CommunityExpress.SteamUnityAPI_RunCallbacks();
            if (this._gameserver != null && this._gameserver.IsInitialized)
            {
                CommunityExpress.SteamUnityAPI_SteamGameServer_RunCallbacks();
                for (int index = 0; index < this._gameserverUserStatsReceivedCallHandles.Count; ++index)
                {
                    ulong callHandle = this._gameserverUserStatsReceivedCallHandles[index];
                    byte  failed;
                    if (CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(callHandle, out failed))
                    {
                        GSStatsReceived_t   result       = new GSStatsReceived_t();
                        UserStatsReceived_t CallbackData = new UserStatsReceived_t();
                        CommunityExpress.SteamUnityAPI_SteamUtils_GetGameServerUserStatsReceivedResult(callHandle, out result, out failed);
                        CallbackData.m_nGameID     = (ulong)CommunityExpress.SteamUnityAPI_SteamUtils_GetAppID();
                        CallbackData.m_steamIDUser = result.m_steamIDUser;
                        CallbackData.m_eResult     = result.m_eResult;
                        this._gameserverUserStatsReceivedCallbacks[index](ref CallbackData);
                        this._gameserverUserStatsReceivedCallHandles.RemoveAt(index);
                        this._gameserverUserStatsReceivedCallbacks.RemoveAt(index);
                        --index;
                    }
                }
            }
            if (this._networking != null && this._networking.IsInitialized)
            {
                this._networking.CheckForNewP2PPackets();
            }
            byte failed1;

            if ((long)this._userGetEncryptedAppTicketCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._userGetEncryptedAppTicketCallHandle, out failed1))
            {
                this._userGetEncryptedAppTicketCallback();
                this._userGetEncryptedAppTicketCallHandle = 0UL;
            }
            byte failed2;

            if ((long)this._lobbyCreatedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyCreatedCallHandle, out failed2))
            {
                LobbyCreated_t result = new LobbyCreated_t();
                CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyCreatedResult(this._lobbyCreatedCallHandle, out result, out failed2);
                this._lobbyCreatedCallback(ref result);
                this._lobbyCreatedCallHandle = 0UL;
            }
            byte failed3;

            if ((long)this._lobbyListReceivedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyListReceivedCallHandle, out failed3))
            {
                LobbyMatchList_t result = new LobbyMatchList_t();
                CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyListReceivedResult(this._lobbyListReceivedCallHandle, out result, out failed3);
                this._lobbyListReceivedCallback(ref result);
                this._lobbyListReceivedCallHandle = 0UL;
            }
            byte failed4;

            if ((long)this._lobbyJoinedCallHandle == 0L || !CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyJoinedCallHandle, out failed4))
            {
                return;
            }
            LobbyEnter_t result1 = new LobbyEnter_t();

            CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyEnteredResult(this._lobbyJoinedCallHandle, out result1, out failed4);
            this._lobbyJoinedCallback(ref result1);
            this._lobbyJoinedCallHandle = 0UL;
        }
Пример #5
0
 private static bool SteamUnityAPI_SteamUtils_GetLobbyListReceivedResult(ulong callHandle, out LobbyMatchList_t result, out byte failed);