private void ServerResponded(gameserveritem_t server) { Debug.Log("AutoJoin: Server ping succeeded"); Debug.Log("Starting dedicated client"); SteamDSConfig.isDedicatedServer = false; CoopPeerStarter.DedicatedHost = false; SteamClientDSConfig.isDedicatedClient = true; string[] array = server.GetGameTags().Split(new char[] { ';' }); string guid = (array == null || array.Length <= 0) ? string.Empty : array[0]; SteamClientDSConfig.Guid = guid; SteamClientDSConfig.Server = server; SteamClientDSConfig.serverAddress = server.m_NetAdr.GetConnectionAddressString(); if (!string.IsNullOrEmpty(this.invitedToPassword)) { SteamClientDSConfig.password = SteamDSConfig.PasswordToHash(this.invitedToPassword); } else { SteamClientDSConfig.password = string.Empty; } SteamClientDSConfig.adminPassword = string.Empty; SteamClientDSConfig.EndPoint = UdpEndPoint.Parse(SteamClientDSConfig.serverAddress); }
public SteamworksServerInfo(gameserveritem_t server) { this.entity = new SteamworksCommunityEntity(server.m_steamID); this.name = server.GetServerName(); this.players = (byte)server.m_nPlayers; this.capacity = (byte)server.m_nMaxPlayers; this.ping = server.m_nPing; }
private void MovePendingToUnresponsive() { this.watchList.RemoveAll((int x) => { gameserveritem_t serverDetails = Base.Internal.GetServerDetails(this.request, x); this.OnServer(ServerInfo.From(serverDetails), serverDetails.HadSuccessfulResponse); return(true); }); }
public void onServerResponded(gameserveritem_t server) { SteamworksServerInfo newServerInfo = new SteamworksServerInfo(server); SteamworksServerInfoRequestResult result = new SteamworksServerInfoRequestResult(newServerInfo); this.triggerCallback(result); this.cleanupQuery(); SteamworksMatchmakingService.serverInfoRequestHandles.Remove(this); }
internal bool Test(gameserveritem_t info) { if (AppId != 0 && AppId != info.AppID) { return(false); } return(true); }
private void ProcessServerResponded(HServerListRequest hRequest, int iServer) { gameserveritem_t serverDetails = SteamMatchmakingServers.GetServerDetails(hRequest, iServer); if (serverDetails.m_nAppID == 242760u || serverDetails.m_nAppID == 556450u) { this._validServers++; this._steamServerData.Add(serverDetails); } }
// Token: 0x06000964 RID: 2404 RVA: 0x000451D0 File Offset: 0x000433D0 private void OnJoinServerRespond(gameserveritem_t serverData) { ZLog.Log(string.Concat(new object[] { "Got join server data ", serverData.GetServerName(), " ", serverData.m_steamID })); this.m_joinAddr.SetIPv4(serverData.m_NetAdr.GetIP(), serverData.m_NetAdr.GetConnectionPort()); this.m_haveJoinAddr = true; }
public void OnClientConnectDs(gameserveritem_t server) { bool flag = server.m_nPlayers >= server.m_nMaxPlayers; string[] array = server.GetGameTags().Split(new char[] { ';' }); string item = (array == null || array.Length <= 0) ? string.Empty : array[0]; string a = (array == null || array.Length <= 1) ? "-1" : array[1]; bool flag2 = a != "__E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE"; if (flag2 || flag) { this._joinDsScreen._adminPassword.gameObject.SetActive(false); this._joinDsScreen._password.gameObject.SetActive(false); this._joinDsScreen._newButtonLabel.transform.parent.gameObject.SetActive(false); this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(false); } else { this._joinDsScreen._newButtonLabel.transform.parent.gameObject.SetActive(true); if (this.PreviouslyPlayedServers.Contains(item)) { this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(true); this._joinDsScreen._continueButtonLabel.text = UiTranslationDatabase.TranslateKey("CONTINUE", "Continue", this._allCapsTexts); } else { this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(false); } this._joinDsScreen._adminPassword.gameObject.SetActive(true); this._joinDsScreen._password.gameObject.SetActive(server.m_bPassword); } this._joinDsScreen._prefabDbVersionMissmatch.SetActive(flag2); this._joinDsScreen._prefabServerIsFull.SetActive(flag && !flag2); this._joinDsScreen._serverName.text = server.GetServerName(); this.JoiningServer = server; this._joinDsScreen._ip.text = server.m_NetAdr.GetConnectionAddressString(); if (this._joinDsScreen._ping) { this._joinDsScreen._ping.text = server.m_nPing + "ms"; } this._joinDsScreen._playerLimit.text = StringEx.TryFormat("{0} / {1}", new object[] { server.m_nPlayers, server.m_nMaxPlayers }); this._joinDsScreen._password.value = string.Empty; this._joinDsScreen._adminPassword.value = string.Empty; this.OpenScreen(CoopSteamNGUI.Screens.JoinDS); }
private void ProcessServerResponded(HServerListRequest hRequest, int iServer) { this.listCount++; gameserveritem_t serverDetails = SteamMatchmakingServers.GetServerDetails(hRequest, iServer); if (serverDetails.m_nAppID == 242760u || serverDetails.m_nAppID == 556450u) { MpDedicatedServerRow mpDedicatedServerRow = UnityEngine.Object.Instantiate <MpDedicatedServerRow>(this._rowPrefab); mpDedicatedServerRow.transform.parent = this._mainUI._gameBrowserScreenDS._grid.transform; mpDedicatedServerRow.transform.localScale = this._rowPrefab.transform.localScale; mpDedicatedServerRow.gameObject.SetActive(true); this._previusInstantiateServerRowIsFinished = true; mpDedicatedServerRow._gameName.text = serverDetails.GetServerName(); mpDedicatedServerRow._ip.text = serverDetails.m_NetAdr.GetConnectionAddressString(); mpDedicatedServerRow._ping.text = serverDetails.m_nPing + "ms"; mpDedicatedServerRow._VACProtected.SetActive(serverDetails.m_bSecure); mpDedicatedServerRow._passwordProtected.SetActive(serverDetails.m_bPassword); mpDedicatedServerRow.Server = serverDetails; mpDedicatedServerRow._playerLimit.text = string.Format("{0} / {1}", serverDetails.m_nPlayers, serverDetails.m_nMaxPlayers); this._rows.Add(mpDedicatedServerRow); string[] array = serverDetails.GetGameTags().Split(new char[] { ';' }); string item = (array == null || array.Length <= 0) ? string.Empty : array[0]; string a = (array == null || array.Length <= 1) ? "-1" : array[1]; bool flag = a != "__F486E3E06B8E13E0388571BE0FDC8A35182D8BE83E9256BA53BC5FBBDBCF23BC"; mpDedicatedServerRow._versionMismatch = flag; mpDedicatedServerRow._prefabDbVersionMissmatch.SetActive(flag); mpDedicatedServerRow._previousPlayed = this._mainUI.PreviouslyPlayedServers.Contains(item); mpDedicatedServerRow.RefreshName(this._sortOptions); bool flag2 = !string.IsNullOrEmpty(this._mainUI._gameBrowserScreenDS._filter.value); if (flag2) { string value = this._mainUI._gameBrowserScreenDS._filter.value.ToLowerInvariant(); bool flag3 = mpDedicatedServerRow._gameName.text.ToLowerInvariant().Contains(value); if (mpDedicatedServerRow.gameObject.activeSelf != flag3) { mpDedicatedServerRow.transform.parent = ((!flag3) ? this._mainUI._gameBrowserScreenDS._grid.transform.parent : this._mainUI._gameBrowserScreenDS._grid.transform); mpDedicatedServerRow.gameObject.SetActive(flag3); } } else if (!mpDedicatedServerRow.gameObject.activeSelf) { mpDedicatedServerRow.transform.parent = this._mainUI._gameBrowserScreenDS._grid.transform; mpDedicatedServerRow.gameObject.SetActive(true); } this._mainUI._gameBrowserScreenDS._grid.repositionNow = true; this._mainUI._gameBrowserScreenDS._scrollview.UpdateScrollbars(); } }
public void UpdateResponsive() { this.watchList.RemoveAll((int x) => { bool flag; gameserveritem_t serverDetails = Base.Internal.GetServerDetails(this.request, x); if (!serverDetails.HadSuccessfulResponse) { flag = false; } else { this.OnServer(ServerInfo.From(serverDetails), serverDetails.HadSuccessfulResponse); flag = true; } return(flag); }); }
public void FromGameServerItem(gameserveritem_t item) { serverID = item.m_steamID; serverName = item.GetServerName(); serverDescription = item.GetGameDescription(); mapName = item.GetMap(); isPasswordProtected = item.m_bPassword; isVAC = item.m_bSecure; maxPlayerCount = item.m_nMaxPlayers; currentPlayerCount = item.m_nPlayers; botPlayers = item.m_nBotPlayers; ping = item.m_nPing; serverVersion = item.m_nServerVersion; tags = item.GetGameTags(); address = item.m_NetAdr; lastTimePlayed = SteamUtilities.ConvertUnixDate(item.m_ulTimeLastPlayed); }
private void ProcessServerData(gameserveritem_t server) { this._processedServers++; MpDedicatedServerRow row = this.GetRow(); row._gameName.text = server.GetServerName(); row._ping.text = server.m_nPing + "ms"; if (row._passwordProtected.activeSelf != server.m_bPassword) { row._passwordProtected.SetActive(server.m_bPassword); } row.Server = server; row._playerLimit.text = string.Format("{0} / {1}", server.m_nPlayers, server.m_nMaxPlayers); this._rows.Add(row); string[] array = server.GetGameTags().Split(new char[] { ';' }); string item = (array == null || array.Length <= 0) ? string.Empty : array[0]; string a = (array == null || array.Length <= 1) ? "-1" : array[1]; bool flag = a != "__E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE"; row._versionMismatch = flag; if (row._prefabDbVersionMissmatch.activeSelf != flag) { row._prefabDbVersionMissmatch.SetActive(flag); } row._previousPlayed = this._mainUI.PreviouslyPlayedServers.Contains(item); row.RefreshName(this._sortOptions); bool flag2 = !string.IsNullOrEmpty(this._lastFilterValue); if (flag2) { bool flag3 = row._gameName.text.ToLowerInvariant().Contains(this._lastFilterValue); if (row.gameObject.activeInHierarchy != flag3) { row.transform.SetParent((!flag3) ? this._offGridRows.transform : this._mainUI._gameBrowserScreenDS._grid.transform); } } else if (!row.gameObject.activeInHierarchy) { row.transform.SetParent(this._mainUI._gameBrowserScreenDS._grid.transform); } }
// Token: 0x06000975 RID: 2421 RVA: 0x00045884 File Offset: 0x00043A84 private void OnServerResponded(HServerListRequest request, int iServer) { gameserveritem_t serverDetails = SteamMatchmakingServers.GetServerDetails(request, iServer); string serverName = serverDetails.GetServerName(); ServerData serverData = new ServerData(); serverData.m_name = serverName; serverData.m_steamHostAddr.SetIPv4(serverDetails.m_NetAdr.GetIP(), serverDetails.m_NetAdr.GetConnectionPort()); serverData.m_password = serverDetails.m_bPassword; serverData.m_players = serverDetails.m_nPlayers; serverData.m_version = serverDetails.GetGameTags(); this.m_dedicatedServers.Add(serverData); this.m_updateTriggerAccumulator++; if (this.m_updateTriggerAccumulator > 100) { this.m_updateTriggerAccumulator = 0; this.m_serverListRevision++; } }
private void onPingResponded(gameserveritem_t data) { this.isAttemptingServerQuery = false; this.cleanupServerQuery(); if (data.m_nAppID == Provider.APP_ID.m_AppId) { SteamServerInfo steamServerInfo = new SteamServerInfo(data); if (!steamServerInfo.isPro || Provider.isPro) { if (!steamServerInfo.isPassworded || this.connectionInfo.password != string.Empty) { if (this.autoJoinServerQuery) { Provider.connect(steamServerInfo, this.connectionInfo.password); } else { MenuUI.closeAll(); MenuUI.closeAlert(); MenuPlayServerInfoUI.open(steamServerInfo, this.connectionInfo.password, MenuPlayServerInfoUI.EServerInfoOpenContext.CONNECT); } } else { Provider._connectionFailureInfo = ESteamConnectionFailureInfo.PASSWORD; } } else { Provider._connectionFailureInfo = ESteamConnectionFailureInfo.PRO_SERVER; } } else { Provider._connectionFailureInfo = ESteamConnectionFailureInfo.TIMED_OUT; } if (this.onTimedOut != null) { this.onTimedOut(); } }
private string GameServerItemFormattedString(gameserveritem_t gsi) { return("m_NetAdr: " + gsi.m_NetAdr.GetConnectionAddressString() + "\n" + "m_nPing: " + gsi.m_nPing + "\n" + "m_bHadSuccessfulResponse: " + gsi.m_bHadSuccessfulResponse + "\n" + "m_bDoNotRefresh: " + gsi.m_bDoNotRefresh + "\n" + "m_szGameDir: " + gsi.GetGameDir() + "\n" + "m_szMap: " + gsi.GetMap() + "\n" + "m_szGameDescription: " + gsi.GetGameDescription() + "\n" + "m_nAppID: " + gsi.m_nAppID + "\n" + "m_nPlayers: " + gsi.m_nPlayers + "\n" + "m_nMaxPlayers: " + gsi.m_nMaxPlayers + "\n" + "m_nBotPlayers: " + gsi.m_nBotPlayers + "\n" + "m_bPassword: "******"\n" + "m_bSecure: " + gsi.m_bSecure + "\n" + "m_ulTimeLastPlayed: " + gsi.m_ulTimeLastPlayed + "\n" + "m_nServerVersion: " + gsi.m_nServerVersion + "\n" + "m_szServerName: " + gsi.GetServerName() + "\n" + "m_szGameTags: " + gsi.GetGameTags() + "\n" + "m_steamID: " + gsi.m_steamID + "\n"); }
private void OnPingResponded(gameserveritem_t data) { LogUtils.Log("Server is up, connecting..."); CleanupServerQuery(); if ((AppId_t)data.m_nAppID == GameInfo.ID) { ServerInfo info = new ServerInfo { ServerID = (SteamIdentity)data.m_steamID, Name = data.GetServerName(), Map = data.GetMap(), Ping = data.m_nPing, Players = data.m_nPlayers, MaxPlayers = data.m_nMaxPlayers, HasPassword = data.m_bPassword, IsSecure = data.m_bSecure, }; if (!data.m_bPassword || (((ClientConnection)Connection).CurrentPassword != String.Empty)) { if (((info.Players >= info.MaxPlayers) || (info.MaxPlayers < MIN_PLAYERS)) || (info.MaxPlayers > MAX_PLAYERS)) { return; } CurrentServer = info; ((ClientConnection)Connection).Connect(info); return; // Todo: server full } // Todo: no password } else { CleanupServerQuery(); LogUtils.Log("Wrong game ID received: " + data.m_nAppID + ", expected: " + GameInfo.ID); //Todo: Timeout } }
public void OnClientContinueGameDS(gameserveritem_t server) { Debug.Log("Starting dedicated client"); SteamDSConfig.isDedicatedServer = false; CoopPeerStarter.DedicatedHost = false; SteamClientDSConfig.isDedicatedClient = true; string[] array = server.GetGameTags().Split(new char[] { ';' }); string guid = (array == null || array.Length <= 0) ? string.Empty : array[0]; SteamClientDSConfig.Guid = guid; SteamClientDSConfig.Server = server; SteamClientDSConfig.serverAddress = server.m_NetAdr.GetConnectionAddressString(); if (!string.IsNullOrEmpty(this._joinDsScreen._password.value)) { SteamClientDSConfig.password = SteamDSConfig.PasswordToHash(this._joinDsScreen._password.value); this._joinDsScreen._password.value = string.Empty; } else { SteamClientDSConfig.password = string.Empty; } if (!string.IsNullOrEmpty(this._joinDsScreen._adminPassword.value)) { SteamClientDSConfig.adminPassword = SteamDSConfig.PasswordToHash(this._joinDsScreen._adminPassword.value); this._joinDsScreen._adminPassword.value = string.Empty; } else { SteamClientDSConfig.adminPassword = string.Empty; } SteamClientDSConfig.EndPoint = UdpEndPoint.Parse(SteamClientDSConfig.serverAddress); GameSetup.SetInitType(InitTypes.Continue); UnityEngine.Object.Destroy(base.gameObject); SceneManager.LoadScene("SteamStartSceneDedicatedServer_Client"); }
internal static Server FromSteam(Client c, gameserveritem_t item) { return(new Server(c) { Address = item.m_NetAdr.m_unIP, ConnectionPort = item.m_NetAdr.m_usConnectionPort, QueryPort = item.m_NetAdr.m_usQueryPort, Name = item.m_szServerName, Ping = item.m_nPing, GameDir = item.m_szGameDir, Map = item.m_szMap, Description = item.m_szGameDescription, AppId = item.m_nAppID, Players = item.m_nPlayers, MaxPlayers = item.m_nMaxPlayers, BotPlayers = item.m_nBotPlayers, Passworded = item.m_bPassword, Secure = item.m_bSecure, LastTimePlayed = item.m_ulTimeLastPlayed, Version = item.m_nServerVersion, Tags = item.m_szGameTags == null ? null : item.m_szGameTags.Split(','), SteamId = item.m_steamID }); }
private void OnServerResponded(gameserveritem_t server) => _pingResponded.OnNext(server);
// Token: 0x06003089 RID: 12425 RVA: 0x0013EC70 File Offset: 0x0013D070 public SteamServerInfo(gameserveritem_t data) { this._steamID = data.m_steamID; this._ip = data.m_NetAdr.GetIP(); this._port = data.m_NetAdr.GetConnectionPort(); this._name = data.GetServerName(); if (OptionsSettings.filter) { this._name = ChatManager.filter(this.name); } this._map = data.GetMap(); string gameTags = data.GetGameTags(); if (gameTags.Length > 0) { this._isPvP = (gameTags.IndexOf("PVP") != -1); this._hasCheats = (gameTags.IndexOf("CHEATS") != -1); this._isWorkshop = (gameTags.IndexOf("WORK") != -1); if (gameTags.IndexOf("EASY") != -1) { this._mode = EGameMode.EASY; } else if (gameTags.IndexOf("HARD") != -1) { this._mode = EGameMode.HARD; } else { this._mode = EGameMode.NORMAL; } if (gameTags.IndexOf("FIRST") != -1) { this._cameraMode = ECameraMode.FIRST; } else if (gameTags.IndexOf("THIRD") != -1) { this._cameraMode = ECameraMode.THIRD; } else if (gameTags.IndexOf("BOTH") != -1) { this._cameraMode = ECameraMode.BOTH; } else { this._cameraMode = ECameraMode.VEHICLE; } if (gameTags.IndexOf("GOLDONLY") != -1) { this._isPro = true; } else { this._isPro = false; } this.IsBattlEyeSecure = (gameTags.IndexOf("BATTLEYE_ON") != -1); int num = gameTags.IndexOf(",GAMEMODE:"); int num2 = gameTags.IndexOf(",", num + 1); if (num != -1 && num2 != -1) { num += 10; this.gameMode = gameTags.Substring(num, num2 - num); } else { this.gameMode = null; } } else { this._isPvP = true; this._hasCheats = false; this._mode = EGameMode.NORMAL; this._cameraMode = ECameraMode.FIRST; this._isPro = true; this.IsBattlEyeSecure = false; this.gameMode = null; } this._ping = data.m_nPing; this._players = data.m_nPlayers; this._maxPlayers = data.m_nMaxPlayers; this._isPassworded = data.m_bPassword; this.IsVACSecure = data.m_bSecure; }
private void InternalOnServerResponded(IntPtr thisptr, gameserveritem_t serverItem) { m_ServerResponded(ServerList.Server.FromSteam(client, serverItem)); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_ServerListRequest: " + m_ServerListRequest); GUILayout.Label("m_ServerQuery: " + m_ServerQuery); GUILayout.Label("m_ServerListResponse: " + m_ServerListResponse); GUILayout.Label("m_PingResponse: " + m_PingResponse); GUILayout.Label("m_PlayersResponse: " + m_PlayersResponse); GUILayout.Label("m_RulesResponse: " + m_RulesResponse); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); if (GUILayout.Button("RequestInternetServerList(TestConstants.Instance.k_AppId_TeamFortress2, filters, (uint)filters.Length, m_ServerListResponse)")) { ReleaseRequest(); MatchMakingKeyValuePair_t[] filters = { new MatchMakingKeyValuePair_t { m_szKey = "appid", m_szValue = TestConstants.Instance.k_AppId_TeamFortress2.ToString() }, new MatchMakingKeyValuePair_t { m_szKey = "gamedir", m_szValue = "tf" }, new MatchMakingKeyValuePair_t { m_szKey = "gametagsand", m_szValue = "beta" }, }; m_ServerListRequest = SteamMatchmakingServers.RequestInternetServerList(TestConstants.Instance.k_AppId_TeamFortress2, filters, (uint)filters.Length, m_ServerListResponse); print("SteamMatchmakingServers.RequestInternetServerList(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + filters + ", " + (uint)filters.Length + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("RequestLANServerList(new AppId_t(440), m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestLANServerList(new AppId_t(440), m_ServerListResponse); print("SteamMatchmakingServers.RequestLANServerList(" + new AppId_t(440) + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("RequestFriendsServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestFriendsServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestFriendsServerList(" + new AppId_t(440) + ", " + null + ", " + 0 + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("RequestFavoritesServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestFavoritesServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestFavoritesServerList(" + new AppId_t(440) + ", " + null + ", " + 0 + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("RequestHistoryServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestHistoryServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestHistoryServerList(" + new AppId_t(440) + ", " + null + ", " + 0 + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("RequestSpectatorServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestSpectatorServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestSpectatorServerList(" + new AppId_t(440) + ", " + null + ", " + 0 + ", " + m_ServerListResponse + ") : " + m_ServerListRequest); } if (GUILayout.Button("ReleaseRequest(m_ServerListRequest)")) { ReleaseRequest(); // We do this instead, because we want to make sure that m_ServerListRequested gets set to Invalid after releasing. } if (GUILayout.Button("GetServerDetails(m_ServerListRequest, 0)")) { gameserveritem_t ret = SteamMatchmakingServers.GetServerDetails(m_ServerListRequest, 0); print("SteamMatchmakingServers.GetServerDetails(" + m_ServerListRequest + ", " + 0 + ") : " + ret); print(GameServerItemFormattedString(ret)); } if (GUILayout.Button("CancelQuery(m_ServerListRequest)")) { SteamMatchmakingServers.CancelQuery(m_ServerListRequest); print("SteamMatchmakingServers.CancelQuery(" + m_ServerListRequest + ")"); } if (GUILayout.Button("RefreshQuery(m_ServerListRequest)")) { SteamMatchmakingServers.RefreshQuery(m_ServerListRequest); print("SteamMatchmakingServers.RefreshQuery(" + m_ServerListRequest + ")"); } GUILayout.Label("IsRefreshing(m_ServerListRequest) : " + SteamMatchmakingServers.IsRefreshing(m_ServerListRequest)); GUILayout.Label("GetServerCount(m_ServerListRequest) : " + SteamMatchmakingServers.GetServerCount(m_ServerListRequest)); if (GUILayout.Button("RefreshServer(m_ServerListRequest, 0)")) { SteamMatchmakingServers.RefreshServer(m_ServerListRequest, 0); print("SteamMatchmakingServers.RefreshServer(" + m_ServerListRequest + ", " + 0 + ")"); } if (GUILayout.Button("PingServer(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_PingResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.PingServer(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_PingResponse); print("SteamMatchmakingServers.PingServer(" + TestConstants.k_IpAddress208_78_165_233 + ", " + TestConstants.k_Port27015 + ", " + m_PingResponse + ") : " + m_ServerQuery); } if (GUILayout.Button("PlayerDetails(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_PlayersResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.PlayerDetails(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_PlayersResponse); print("SteamMatchmakingServers.PlayerDetails(" + TestConstants.k_IpAddress208_78_165_233 + ", " + TestConstants.k_Port27015 + ", " + m_PlayersResponse + ") : " + m_ServerQuery); } if (GUILayout.Button("ServerRules(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_RulesResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.ServerRules(TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, m_RulesResponse); print("SteamMatchmakingServers.ServerRules(" + TestConstants.k_IpAddress208_78_165_233 + ", " + TestConstants.k_Port27015 + ", " + m_RulesResponse + ") : " + m_ServerQuery); } if (GUILayout.Button("CancelServerQuery(m_ServerQuery)")) { CancelServerQuery(); // We do this instead, because we want to make sure that m_ServerListRequested gets set to Invalid after releasing, and we call it from a number of places. } GUILayout.EndScrollView(); GUILayout.EndVertical(); }
private void onServerListResponded(HServerListRequest request, int index) { if (request != this.serverListRequest) { return; } gameserveritem_t serverDetails = SteamMatchmakingServers.GetServerDetails(request, index); if (this.matchmakingIgnored.Contains(serverDetails.m_steamID.m_SteamID)) { return; } SteamServerInfo steamServerInfo = new SteamServerInfo(serverDetails); if (index == this.serverListRefreshIndex) { if (this.onMasterServerQueryRefreshed != null) { this.onMasterServerQueryRefreshed(steamServerInfo); } return; } if (FilterSettings.filterPlugins == EPlugins.NO) { if (serverDetails.m_nBotPlayers != 0) { return; } } else if (FilterSettings.filterPlugins == EPlugins.YES && serverDetails.m_nBotPlayers != 1) { return; } if (steamServerInfo.maxPlayers < (int)CommandMaxPlayers.MIN_NUMBER) { return; } if (this.currentList == ESteamServerList.INTERNET) { if (steamServerInfo.maxPlayers > (int)(CommandMaxPlayers.MAX_NUMBER / 2)) { return; } } else if (steamServerInfo.maxPlayers > (int)CommandMaxPlayers.MAX_NUMBER) { return; } if (PlaySettings.serversName != null && PlaySettings.serversName.Length > 1 && steamServerInfo.name.IndexOf(PlaySettings.serversName, StringComparison.OrdinalIgnoreCase) == -1) { return; } int num = this.serverList.BinarySearch(steamServerInfo, this.serverInfoComparer); if (num < 0) { num = ~num; } this.serverList.Insert(num, steamServerInfo); if (this.onMasterServerAdded != null) { this.onMasterServerAdded(num, steamServerInfo); } this.matchmakingBestServer = null; int num2 = 25; while (this.matchmakingBestServer == null && num2 <= OptionsSettings.maxMatchmakingPing) { int num3 = -1; foreach (SteamServerInfo steamServerInfo2 in this.serverList) { if (steamServerInfo2.players < OptionsSettings.minMatchmakingPlayers) { break; } if (steamServerInfo2.players != num3) { num3 = steamServerInfo2.players; if (steamServerInfo2.ping <= num2) { this.matchmakingBestServer = steamServerInfo2; break; } } } num2 += 25; } if (this.matchmakingProgressed != null) { this.matchmakingProgressed(); } }
internal void ServerResponded(ref gameserveritem_t server) { _ServerResponded(Self, ref server); }
private static extern void _ServerResponded(IntPtr self, ref gameserveritem_t server);
private void OnServerRespondedPing(gameserveritem_t server) { CancelServerQuery(); queryTarget.FromGameServerItem(server); PingCompleted.Invoke(queryTarget); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_ServerListRequest: " + m_ServerListRequest); GUILayout.Label("m_ServerQuery: " + m_ServerQuery); GUILayout.EndArea(); if (GUILayout.Button("RequestInternetServerList(new AppId_t(440), filters, (uint)filters.Length, m_ServerListResponse)")) { ReleaseRequest(); MatchMakingKeyValuePair_t[] filters = new MatchMakingKeyValuePair_t[1]; filters[0].m_szKey = "map"; filters[0].m_szValue = "cp_granary"; m_ServerListRequest = SteamMatchmakingServers.RequestInternetServerList(new AppId_t(440), filters, (uint)filters.Length, m_ServerListResponse); print("SteamMatchmakingServers.RequestInternetServerList(" + new AppId_t(440) + ", filters, (uint)filters.Length, m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("RequestLANServerList(new AppId_t(440), m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestLANServerList(new AppId_t(440), m_ServerListResponse);; print("SteamMatchmakingServers.RequestLANServerList(" + new AppId_t(440) + ", m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("RequestFriendsServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestFriendsServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestFriendsServerList(" + new AppId_t(440) + ", null, 0, m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("RequestFavoritesServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestFavoritesServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestFavoritesServerList(" + new AppId_t(440) + ", null, 0, m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("RequestHistoryServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestHistoryServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestHistoryServerList(" + new AppId_t(440) + ", null, 0, m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("RequestSpectatorServerList(new AppId_t(440), null, 0, m_ServerListResponse)")) { ReleaseRequest(); m_ServerListRequest = SteamMatchmakingServers.RequestSpectatorServerList(new AppId_t(440), null, 0, m_ServerListResponse); print("SteamMatchmakingServers.RequestSpectatorServerList(" + new AppId_t(440) + ", null, 0, m_ServerListResponse) : " + m_ServerListRequest); } if (GUILayout.Button("ReleaseRequest(m_ServerListRequest)")) { ReleaseRequest(); // We do this instead, because we want to make sure that m_ServerListRequested gets set to Invalid after releasing. } if (GUILayout.Button("GetServerDetails(m_ServerListRequest, 0)")) { gameserveritem_t gsi = SteamMatchmakingServers.GetServerDetails(m_ServerListRequest, 0); print("SteamMatchmakingServers.GetServerDetails(" + m_ServerListRequest + ", 0) : " + gsi + "\n" + GameServerItemFormattedString(gsi)); } if (GUILayout.Button("CancelQuery(m_ServerListRequest)")) { SteamMatchmakingServers.CancelQuery(m_ServerListRequest); print("SteamMatchmakingServers.CancelQuery(" + m_ServerListRequest + ")"); } if (GUILayout.Button("RefreshQuery(m_ServerListRequest)")) { SteamMatchmakingServers.RefreshQuery(m_ServerListRequest); print("SteamMatchmakingServers.RefreshQuery(" + m_ServerListRequest + ")"); } GUILayout.Label("SteamMatchmakingServers.IsRefreshing(m_ServerListRequest) : " + SteamMatchmakingServers.IsRefreshing(m_ServerListRequest)); GUILayout.Label("SteamMatchmakingServers.GetServerCount(m_ServerListRequest) : " + SteamMatchmakingServers.GetServerCount(m_ServerListRequest)); if (GUILayout.Button("RefreshServer(m_ServerListRequest, 0)")) { SteamMatchmakingServers.RefreshServer(m_ServerListRequest, 0); print("SteamMatchmakingServers.RefreshServer(" + m_ServerListRequest + ", 0)"); } // 3494815209 = 208.78.165.233 = Valve Payload Server (Virginia srcds150 #1) if (GUILayout.Button("PingServer(3494815209, 27015, m_PingResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.PingServer(3494815209, 27015, m_PingResponse); print("SteamMatchmakingServers.PingServer(3494815209, 27015, m_PingResponse) : " + m_ServerQuery); } if (GUILayout.Button("PlayerDetails(3494815209, 27015, m_PlayersResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.PlayerDetails(3494815209, 27015, m_PlayersResponse); print("SteamMatchmakingServers.PlayerDetails(3494815209, 27015, m_PlayersResponse) : " + m_ServerQuery); } if (GUILayout.Button("ServerRules(3494815209, 27015, m_RulesResponse)")) { CancelServerQuery(); m_ServerQuery = SteamMatchmakingServers.ServerRules(3494815209, 27015, m_RulesResponse); print("SteamMatchmakingServers.ServerRules(3494815209, 27015, m_RulesResponse) : " + m_ServerQuery); } if (GUILayout.Button("CancelServerQuery(m_ServerQuery)")) { CancelServerQuery(); // We do this instead, because we want to make sure that m_ServerListRequested gets set to Invalid after releasing, and we call it from a number of places. } }
// ISteamMatchmakingPingResponse private void OnServerResponded(gameserveritem_t gsi) { Debug.Log("OnServerResponded: " + gsi + "\n" + GameServerItemFormattedString(gsi)); }