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(); }
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); }
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); } } }
// 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; }
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()); }
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)); } }
void OnGetLobbiesList(LobbyMatchList_t result) { for (int i = 0; i < result.m_nLobbiesMatching; ++i) { CSteamID lobbyId = SteamMatchmaking.GetLobbyByIndex(i); lobbyIDS.Add(lobbyId); SteamMatchmaking.RequestLobbyData(lobbyId); } }
/// <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); } }
private static void LobbyMatchList(LobbyMatchList_t param) { int num = 0; while ((long)num < (long)((ulong)param.m_nLobbiesMatching)) { CoopLobbyManager.GetLobbyInfo(SteamMatchmaking.GetLobbyByIndex(num)); num++; } }
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); } }
//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)); }
void ListCall(LobbyMatchList_t cb) { if (cb.m_nLobbiesMatching != 0) { JoinLobby(SteamMatchmaking.GetLobbyByIndex(0)); } else { CreateLobby(ELobbyType.k_ELobbyTypePublic); } }
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 OnFindLobbies(LobbyMatchList_t pLobbyMatchList, bool bIOFailure) { if (!bIOFailure) { SteamMatches.s_nLobbiesFound = (int)pLobbyMatchList.m_nLobbiesMatching; } else { SteamMatches.s_nLobbiesFound = 0; } SteamMatches.s_OnFindLobbies.Invoke(bIOFailure); }
// SteamAPICall_t public CallbackHandle RequestLobbyList(Action <LobbyMatchList_t, bool> CallbackFunction = null /*Action<LobbyMatchList_t, bool>*/) { SteamAPICall_t callback = 0; callback = platform.ISteamMatchmaking_RequestLobbyList(); if (CallbackFunction == null) { return(null); } return(LobbyMatchList_t.CallResult(steamworks, callback, CallbackFunction)); }
void OnLobbyList(LobbyMatchList_t callback, bool error) { if (error) { return; } //how many lobbies matched uint lobbiesMatching = callback.LobbiesMatching; // lobbies are returned in order of closeness to the user, so add them to the list in that order for (int i = 0; i < lobbiesMatching; i++) { //add the lobby to the list of requests ulong lobby = client.native.matchmaking.GetLobbyByIndex(i); if (requests.Contains(lobby)) { continue; } requests.Add(lobby); //cast to a LobbyList.Lobby Lobby newLobby = Lobby.FromSteam(client, lobby); if (newLobby.Name != "") { //if the lobby is valid add it to the valid return lobbies Lobbies.Add(newLobby); checkFinished(); } else { //else we need to get the info for the missing lobby client.native.matchmaking.RequestLobbyData(lobby); if (!registeredLobbyDataUpdated) { client.RegisterCallback <SteamNative.LobbyDataUpdate_t>(OnLobbyDataUpdated); registeredLobbyDataUpdated = true; } } } checkFinished(); if (OnLobbiesUpdated != null) { OnLobbiesUpdated(); } }
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."; } } }
public void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure) { //check if we failed to get a list of matches if (bIOFailure == false) { Debug.Log("[" + LobbyMatchList_t.k_iCallback + " - LobbyMatchList] - " + pCallback.m_nLobbiesMatching); for (int i = 0; i < (int)pCallback.m_nLobbiesMatching - 1; i++) { GetLobbyByIndex(i); } } else { Debug.Log("Unable to get LobbyMatchList"); } }
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); } }
// 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()); } }
/// <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); }
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); }
// 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(); }
void OnLobbyList(LobbyMatchList_t callback, bool error) { if (error) { return; } //how many lobbies matched uint lobbiesMatching = callback.LobbiesMatching; // lobbies are returned in order of closeness to the user, so add them to the list in that order for (int i = 0; i < lobbiesMatching; i++) { //request lobby data ulong lobby = client.native.matchmaking.GetLobbyByIndex(i); client.native.matchmaking.RequestLobbyData(lobby); } }
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(); }
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); } }
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); }
void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure) { Debug.Log("[" + LobbyMatchList_t.k_iCallback + " - LobbyMatchList] - " + pCallback.m_nLobbiesMatching); }