Ejemplo n.º 1
0
        // Token: 0x06000002 RID: 2 RVA: 0x000021C4 File Offset: 0x000003C4
        private static void OnGetLobbiesList(LobbyMatchList_t result)
        {
            Console.WriteLine(result.m_nLobbiesMatching);
            int num = 0;

            while ((long)num < (long)((ulong)result.m_nLobbiesMatching))
            {
                CSteamID lobbyByIndex = SteamMatchmaking.GetLobbyByIndex(num);
                Console.WriteLine(lobbyByIndex);
                string lobbyData = SteamMatchmaking.GetLobbyData(lobbyByIndex, "name");
                try
                {
                    Console.WriteLine(lobbyData.Substring(0, lobbyData.Length - 8));
                }
                catch
                {
                    Console.WriteLine("Unknown");
                }
                try
                {
                    Console.WriteLine((int)(Convert.ToInt16(SteamMatchmaking.GetLobbyData(lobbyByIndex, "type")) - 1549));
                }
                catch
                {
                    Console.WriteLine(4);
                }
                Console.WriteLine(SteamMatchmaking.GetNumLobbyMembers(lobbyByIndex));
                Console.WriteLine(SteamMatchmaking.GetLobbyMemberLimit(lobbyByIndex));
                Console.WriteLine(SteamMatchmaking.GetLobbyData(lobbyByIndex, "lobbydata"));
                num++;
            }
            Program.finished = true;
        }
Ejemplo n.º 2
0
        public static void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
        {
            if (!SteamManager.Initialized)
            {
                Logger.Error("CONNECTION FAILED");
                return;
            }
            uint numLobbies = pCallback.m_nLobbiesMatching;

            Logger.Debug($"Found {numLobbies} total lobbies");
            LobbyData.Clear();
            MultiplayerListing.refreshLobbyList();
            try
            {
                for (int i = 0; i < numLobbies; i++)
                {
                    CSteamID lobbyId = SteamMatchmaking.GetLobbyByIndex(i);
                    if (lobbyId.m_SteamID == _lobbyInfo.LobbyID.m_SteamID)
                    {
                        continue;
                    }
                    LobbyInfo info = new LobbyInfo(SteamMatchmaking.GetLobbyData(lobbyId, "LOBBY_INFO"));

                    SetOtherLobbyData(lobbyId.m_SteamID, info, false);
                    Logger.Info($"{info.HostName} has {info.UsedSlots} users in it and is currently {info.Status}");
                }
            } catch (Exception e)
            {
                Logger.Error(e);
            }

            MultiplayerListing.refreshLobbyList();
        }
        public void LobbySearchFinished(LobbyMatchList_t pLobbyMatchList)
        {
            lobbies.Clear();
            int numberOfResults = (int)pLobbyMatchList.m_nLobbiesMatching;
            int numberOfLobbies = 0;

            for (int i = 0; i < numberOfResults; i++)
            {
                CSteamID  lobby = SteamMatchmaking.GetLobbyByIndex(i);
                LobbyInfo info  = new LobbyInfo(lobby);
                if (info.UpdateLobbyInfo(lobby))
                {
                    lobbies.Add(info);
                    numberOfLobbies++;
                }
            }
            searching = false;
            {
                patch_ProcessManager patchPM = ((patch_ProcessManager)Patches.patch_Rainworld.mainRW.processManager);
                if ((patchPM.currentMainLoop is LobbyFinderMenu))
                {
                    (patchPM.currentMainLoop as LobbyFinderMenu).searchFinished(numberOfLobbies);
                }
            }
        }
	void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure) {
		if (bIOFailure) {
			ESteamAPICallFailure reason = SteamUtils.GetAPICallFailureReason(m_LobbyMatchListCallResult.Handle);
			Debug.LogError("OnLobbyMatchList encountered an IOFailure due to: " + reason);
			return; // TODO: Recovery
		}

		Debug.Log("[" + LobbyMatchList_t.k_iCallback + " - LobbyMatchList] - " + pCallback.m_nLobbiesMatching);

		if (pCallback.m_nLobbiesMatching == 0) {
			ChangeState(EChatClientState.NoLobbiesFound);
			return;
		}

		m_Lobbies = new Lobby[pCallback.m_nLobbiesMatching];
		for (int i = 0; i < pCallback.m_nLobbiesMatching; ++i) {
            UpdateLobbyInfo(SteamMatchmaking.GetLobbyByIndex(i), ref m_Lobbies[i]);

			/*uint IP;
			ushort Port;
			CSteamID GameServerSteamID;
			bool lobbyGameServerRet = SteamMatchmaking.GetLobbyGameServer(m_Lobbies[i].m_SteamID, out IP, out Port, out GameServerSteamID);
			print("IP: " + IP);
			print("Port: " + Port);
			print("GSID: " + GameServerSteamID);*/

		}

		ChangeState(EChatClientState.DisplayResults);
	}
Ejemplo n.º 5
0
 public unsafe static Lobby GetSearchLobbyAtIndex(int index)
 {
     if (!_initialized)
     {
         return(null);
     }
     return(new Lobby(SteamMatchmaking.GetLobbyByIndex(index)));
 }
        private static GameServer[] HandleGameLobbies(LobbyMatchList_t param)
        {
            var lobbies = new List <GameServer>();

            for (int i = 0; i < param.m_nLobbiesMatching; i++)
            {
                var lobbyId = SteamMatchmaking.GetLobbyByIndex(i);

                if (SteamMatchmaking.RequestLobbyData(lobbyId))
                {
                    var indicator = SteamMatchmaking.GetLobbyData(lobbyId, LobbyDataKeys.STEAM_SPY_INDICATOR);

                    if (!indicator.IsNullOrEmpty() && indicator == SteamConstants.INDICATOR)
                    {
                        var ownerId = SteamMatchmaking.GetLobbyData(lobbyId, LobbyDataKeys.HOST_STEAM_ID);
                        var id      = ownerId.ParseToUlongOrDefault();

                        if (id == 0)
                        {
                            continue;
                        }

                        var ownerSteamId = new CSteamID(id);

                        if (ownerSteamId == SteamUser.GetSteamID())
                        {
                            continue;
                        }

                        var server = new GameServer();

                        server.HostSteamId = ownerSteamId;

                        var rowCount = SteamMatchmaking.GetLobbyDataCount(lobbyId);

                        string key;
                        string value;

                        for (int k = 0; k < rowCount; k++)
                        {
                            if (SteamMatchmaking.GetLobbyDataByIndex(lobbyId, k, out key, 100, out value, 100))
                            {
                                server.Set(key, value);
                            }
                        }

                        if (!server.HasPlayers)
                        {
                            continue;
                        }

                        lobbies.Add(server);
                    }
                }
            }

            return(lobbies.ToArray());
        }
Ejemplo n.º 7
0
 private void OnFindPublicLobbies(LobbyMatchList_t callback)
 {
     print(callback.m_nLobbiesMatching);
     if (callback.m_nLobbiesMatching != 0)
     {
         print(callback.m_nLobbiesMatching);
         print(SteamMatchmaking.GetLobbyByIndex((int)callback.m_nLobbiesMatching));
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Handle the RequestLobbyList Steam API callback
 /// </summary>
 /// <param name="result">The <see cref="LobbyMatchList_t"/> result set</param>
 private void OnLobbyListRequested(LobbyMatchList_t result)
 {
     for (int i = 0; i < result.m_nLobbiesMatching; i++)
     {
         var lobbyId = SteamMatchmaking.GetLobbyByIndex(i);
         AddServer(lobbyId);
         SteamMatchmaking.RequestLobbyData(lobbyId);
     }
 }
Ejemplo n.º 9
0
 void OnGetLobbiesList(LobbyMatchList_t result)
 {
     //Debug.Log("Found " + result.m_nLobbiesMatching + " lobbies!");
     for (int i = 0; i < result.m_nLobbiesMatching; i++)
     {
         CSteamID lobbyID = SteamMatchmaking.GetLobbyByIndex(i);
         lobbyIDS.Add(lobbyID);
         SteamMatchmaking.RequestLobbyData(lobbyID);
     }
 }
Ejemplo n.º 10
0
 //Steam callback action
 private void LobbySearch(LobbyMatchList_t callback)
 {
     //Create new lobby if none are open
     if (callback.m_nLobbiesMatching <= 0)
     {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, networkManager.maxConnections);
     }
     //Only joins the first lobby found (so not truly random but whatever)
     SteamMatchmaking.JoinLobby(SteamMatchmaking.GetLobbyByIndex(0));
 }
Ejemplo n.º 11
0
 public static CSteamID GetLobby(int Index)
 {
     if (s_nFriendLobbiesFound > 0)
     {
         return(m_friendLobbies[Index]);
     }
     else
     {
         return((CSteamID)SteamMatchmaking.GetLobbyByIndex(Index));
     }
 }
Ejemplo n.º 12
0
 void ListCall(LobbyMatchList_t cb)
 {
     if (cb.m_nLobbiesMatching != 0)
     {
         JoinLobby(SteamMatchmaking.GetLobbyByIndex(0));
     }
     else
     {
         CreateLobby(ELobbyType.k_ELobbyTypePublic);
     }
 }
Ejemplo n.º 13
0
        void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
        {
            uint numLobbies = pCallback.m_nLobbiesMatching;

            Debug.Log("Available lobbies: " + numLobbies);
            if (numLobbies > 0)
            {
                Debug.Log("Joining lobby");
                CSteamID lobby = SteamMatchmaking.GetLobbyByIndex(0);
                JoinLobby(lobby);
            }
        }
    public void GetLobbyByIndex(int index)
    {
        CSteamID m_LobbyValue = SteamMatchmaking.GetLobbyByIndex(index);

        Debug.Log("SteamMatchmaking.SteamMatchmaking.GetLobbyByIndex(0) : " + m_LobbyValue);

        LobbyValue _lobby = new LobbyValue();

        _lobby.name       = SteamMatchmaking.GetLobbyData(m_LobbyValue, "name");
        _lobby.lobbyIndex = index;
        _lobby.lobby      = m_LobbyValue;
        m_LobbyList.Add(_lobby);
    }
Ejemplo n.º 15
0
    protected void OnGotLobbyList(LobbyMatchList_t pCallback, bool bIOfailure)
    {
        uint numLobbies = pCallback.m_nLobbiesMatching;

        Debug.Log(numLobbies + " lobbies found.");
        GameMatchmakingInfo[] lobbies = new GameMatchmakingInfo[numLobbies];
        for (int i = 0; i < numLobbies; i++)
        {
            lobbies[i].id   = SteamMatchmaking.GetLobbyByIndex(i).m_SteamID;
            lobbies[i].name = SteamMatchmaking.GetLobbyData(new CSteamID(lobbies[i].id), "name");

            lobbies[i].callback = OnGetLobbySelection;
        }
        networkUIController.RequestLobbySelection(OnGetLobbySelection, lobbies);
    }
 void OnGetLobbiesList(LobbyMatchList_t result)
 {
     for (int i = 0; i < result.m_nLobbiesMatching; i++)
     {
         if (SteamMatchmaking.GetLobbyData((CSteamID)SteamMatchmaking.GetLobbyByIndex(i), "ServerIP") != "")
         {
             SteamMatchmaking.JoinLobby((CSteamID)SteamMatchmaking.GetLobbyByIndex(i));
             return;
         }
         else
         {
             awaitMsg.text = "No matches found.";
         }
     }
 }
Ejemplo n.º 17
0
        public async Task <IEnumerable <LobbyInfo> > GetLobbies()
        {
            if (!SteamManager.Initialized)
            {
                return(Enumerable.Empty <LobbyInfo>());
            }
            var lobbyList = await SteamMatchmaking.RequestLobbyList().ToTask <LobbyMatchList_t>();

            lobbies.Clear();
            for (var i = 0; i < lobbyList.m_nLobbiesMatching; i++)
            {
                var id = SteamMatchmaking.GetLobbyByIndex(i);
                lobbies.Add(CreateLobbyInfo(id));
            }
            return(lobbies);
        }
Ejemplo n.º 18
0
    void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
    {
        uint numLobbies = pCallback.m_nLobbiesMatching;

        if (numLobbies <= 0)
        {
            CreateLobby();
        }
        else
        {
            // If multiple lobbies are returned we can iterate over them with SteamMatchmaking.GetLobbyByIndex and choose the "best" one
            // In this case we are just joining the first one
            Debug.Log("Joining lobby");
            var lobby = SteamMatchmaking.GetLobbyByIndex(0);
            JoinLobby(lobby);
        }
    }
Ejemplo n.º 19
0
    // Token: 0x06000970 RID: 2416 RVA: 0x00045688 File Offset: 0x00043888
    private void OnLobbyMatchList(LobbyMatchList_t data, bool ioError)
    {
        this.m_refreshingPublicGames = false;
        this.m_matchmakingServers.Clear();
        int num = 0;

        while ((long)num < (long)((ulong)data.m_nLobbiesMatching))
        {
            CSteamID   lobbyByIndex    = SteamMatchmaking.GetLobbyByIndex(num);
            ServerData lobbyServerData = this.GetLobbyServerData(lobbyByIndex);
            if (lobbyServerData != null)
            {
                this.m_matchmakingServers.Add(lobbyServerData);
            }
            num++;
        }
        this.m_serverListRevision++;
    }
    private void OnLobbyMatchedList(LobbyMatchList_t pCallback, bool ioFailed)
    {
        if (ioFailed)
        {
            return;
        }

        List <string> lobbyNames = new List <string>();

        for (int i = 0; i < pCallback.m_nLobbiesMatching; i++)
        {
            var lobbyID   = SteamMatchmaking.GetLobbyByIndex(i);
            var LobbyName = SteamMatchmaking.GetLobbyData(lobbyID, "name");
            lobbyNames.Add(LobbyName);

            GameObject.Find("LobbyListPanel").GetComponent <LobbyListPanel>().SetLobbyList(lobbyNames.ToArray());
        }
    }
Ejemplo n.º 21
0
        /// <summary>
        ///     Called when the player recieves a steam lobby list after requestng the lobbies. Determines if the list is for a playlist or a custom game.
        /// <para/>
        ///     If it is a playlist determines if a valid lobby exists or if one must be created. If one is created that player is host.
        /// </summary>
        /// <param name="pCallback"></param>
        private void OnLobbyListReceived(LobbyMatchList_t pCallback)
        {
            if (NetLogFilter.logInfo)
            {
                Debug.Log($"Lobby list recieved, getting matches | ({Time.time})");
            }
            List <CSteamID> validIds = new List <CSteamID>();

            for (int i = 0; i < pCallback.m_nLobbiesMatching; i++)
            {
                CSteamID id = SteamMatchmaking.GetLobbyByIndex(i);
                if (id.IsValid())
                {
                    validIds.Add(id);
                }
            }

            LobbyListReceived?.Invoke(validIds);
        }
Ejemplo n.º 22
0
    // Callback for SteamMatchmaking RequestLobbyList
    private void OnLobbyMatchList(LobbyMatchList_t lobbyMatchList, bool bIOfailure)
    {
        uint num = lobbyMatchList.m_nLobbiesMatching;

        print(num);
        // If no lobbies create one
        if (num < 1)
        {
            SteamAPICall_t result = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 2);
            m_CallResultLobbyCreated.Set(result, OnLobbyCreated);
        }
        else
        {
            CSteamID       lobby  = SteamMatchmaking.GetLobbyByIndex(0);
            SteamAPICall_t result = SteamMatchmaking.JoinLobby(lobby);
        }

        SteamAPI.RunCallbacks();
    }
Ejemplo n.º 23
0
 private unsafe static void OnSearchForLobby(LobbyMatchList_t result, bool ioFailure)
 {
     if (!_initialized)
     {
         return;
     }
     if (result.m_nLobbiesMatching != 0)
     {
         lobbySearchResult = new Lobby(SteamMatchmaking.GetLobbyByIndex(0));
         lobbiesFound      = (int)result.m_nLobbiesMatching;
     }
     else
     {
         lobbySearchResult = null;
         lobbiesFound      = 0;
     }
     lobbySearchComplete = true;
     LobbySearchComplete?.Invoke(lobbySearchResult);
 }
Ejemplo n.º 24
0
    private void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
    {
        if (bIOFailure)
        {
            var reason = SteamUtils.GetAPICallFailureReason(m_LobbyMatchListCallResult.Handle);
            Debug.LogError("OnLobbyMatchList encountered an IOFailure due to: " + reason);
            return;
        }
        if (pCallback.m_nLobbiesMatching == 0)
        {
            return;
        }

        m_Lobbies = new Lobby[pCallback.m_nLobbiesMatching];
        for (var i = 0; i < pCallback.m_nLobbiesMatching; ++i)
        {
            UpdateLobbyInfo(SteamMatchmaking.GetLobbyByIndex(i), ref m_Lobbies[i]);
        }
        DesplayList();
    }
        public async Task <IList <Lobby> > SearchLobbies(Action <ILobbySearchBuilder> builder = null)
        {
            var queryBuilder = new LobbySearchBuilder();

            builder?.Invoke(queryBuilder);
            var list = await SteamMatchmaking.RequestLobbyList().ToTask <LobbyMatchList_t>();

            var results = new Lobby[list.m_nLobbiesMatching];

            for (var i = 0; i < list.m_nLobbiesMatching; i++)
            {
                var lobbyId = SteamMatchmaking.GetLobbyByIndex(i);
                if (!lobbyId.IsValid())
                {
                    continue;
                }
                results[i] = new SteamLobby(lobbyId, this);
            }
            return(results);
        }
Ejemplo n.º 26
0
    void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
    {
        uint numLobbies = pCallback.m_nLobbiesMatching;

        if (numLobbies <= 0)
        {
            // no lobbies found. create one
            Debug.Log("Creating lobby");

            UNETServerController.inviteFriendOnStart = false;
            SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, MAX_USERS);
            // ...continued in OnLobbyEntered callback
        }
        else
        {
            // If multiple lobbies are returned we can iterate over them with SteamMatchmaking.GetLobbyByIndex and choose the "best" one
            // In this case we are just joining the first one
            Debug.Log("Joining lobby");
            var lobby = SteamMatchmaking.GetLobbyByIndex(0);
            JoinLobby(lobby);
        }
    }
Ejemplo n.º 27
0
        private void OnLobbyMatchList(LobbyMatchList_t result)
        {
            stats.OnLobbyMatchListCount++;
            Debug.WriteLine("OnLobbyMatchList: count=" + result.m_nLobbiesMatching);

            for (int i = 0; i < result.m_nLobbiesMatching; i++)
            {
                CSteamID lobbyID = SteamMatchmaking.GetLobbyByIndex(i);
                if (lobbyID.IsValid())
                {
                    RequestLobbyData(lobbyID);
                }
                else
                {
                    Debug.WriteLine("OnLobbyMatchList: invalid lobbyID at index: " + i);
                }
            }

            lobbyRequestBtn.Enabled   = true;
            lobbyRequestTimer.Enabled = true;

            lastUpdateLabel.Text = DateTime.Now.ToString("HH:mm", CultureInfo.InvariantCulture);
        }