Exemplo n.º 1
0
            public async Task <gameserveritem_t> GetDetails()
            {
                var r = _pingResponded.ConnectErrorSource(_session.ThrownExceptions).Take(1).TakeUntil(_pingFailed).ToTask();
                await _session.Scheduler.Execute(() => _request = SteamMatchmakingServers.PingServer(_ip, _port, _mPingResponse));

                return(await r);
            }
Exemplo n.º 2
0
        public void PingServer(HeathenGameServerBrowserEntery target)
        {
            CancelServerQuery();
            queryTarget = target;

            m_ServerQuery = SteamMatchmakingServers.PlayerDetails(target.address.GetIP(), target.address.GetQueryPort(), m_PlayersResponse);
        }
Exemplo n.º 3
0
 public void RefreshServerPlayerList(HeathenGameServerBrowserEntery target)
 {
     CancelServerQuery();
     queryTarget = target;
     playersListWorking.Clear();
     m_ServerQuery = SteamMatchmakingServers.PlayerDetails(target.address.GetIP(), target.address.GetQueryPort(), m_PlayersResponse);
 }
Exemplo n.º 4
0
 private void FinalizeRequest(bool forDisable = false)
 {
     SteamMatchmakingServers.ReleaseRequest(this._request);
     this._response = null;
     if (this._spinner)
     {
         this._spinner.SetActive(false);
     }
     if (!forDisable)
     {
         foreach (MpGameRow mpGameRow in this._rows)
         {
             MpDedicatedServerRow mpDedicatedServerRow = (MpDedicatedServerRow)mpGameRow;
             if (mpDedicatedServerRow)
             {
                 UITweener componentInChildren = mpDedicatedServerRow._VACProtected.GetComponentInChildren <UITweener>();
                 if (componentInChildren)
                 {
                     componentInChildren.enabled = true;
                 }
             }
         }
         this._mainUI._gameBrowserScreenDS._grid.repositionNow = true;
         this._mainUI._gameBrowserScreenDS._scrollview.UpdateScrollbars();
         this.CheckValidScrollBar();
     }
 }
Exemplo n.º 5
0
 public void RefreshServerRules(HeathenGameServerBrowserEntery target)
 {
     CancelServerQuery();
     queryTarget = target;
     rulesListWorking.Clear();
     m_ServerQuery = SteamMatchmakingServers.ServerRules(target.address.GetIP(), target.address.GetQueryPort(), m_RulesResponse);
 }
Exemplo n.º 6
0
 private void ServerResponded(HServerListRequest hRequest, int iServer)
 {
     this._requestSteamServers.Add(new CoopDedicatedServerList.RequestSteamServer(hRequest, iServer));
     if (this._totalServerRequested == 0)
     {
         this._totalServerRequested = SteamMatchmakingServers.GetServerCount(hRequest);
     }
 }
Exemplo n.º 7
0
 private async void OnServerResponded(HServerListRequest hrequest, int iserver)
 {
     await Schedule(() => {
         var s = SteamMatchmakingServers.GetServerDetails(hrequest, iserver);
         _resultsReceived++;
         _serverInfoReceived.OnNext(s);
     });
 }
Exemplo n.º 8
0
            public async Task <IDictionary <string, string> > GetRules()
            {
                var completeObs = _rulesCompleted.ConnectErrorSource(_session.ThrownExceptions).Take(1).Merge(_rulesFailed.Take(1));
                var dict        = _rulesResponded.TakeUntil(completeObs).ToDictionary(x => x.Item1, x => x.Item2).ToTask();
                await _session.Scheduler.Execute(() => _request = SteamMatchmakingServers.ServerRules(_ip, _port, _mRulesResponse));

                return(await dict);
            }
Exemplo n.º 9
0
            public async Task <IList <Tuple <string, int, float> > > GetPlayers()
            {
                var completeObs = _playerCompleted.ConnectErrorSource(_session.ThrownExceptions).Take(1).Merge(_playerFailed.Take(1));
                var dict        = _playerResponded.TakeUntil(completeObs).ToList().ToTask();
                await _session.Scheduler.Execute(() => _request = SteamMatchmakingServers.PlayerDetails(_ip, _port, _mPlayersResponse));

                return(await dict);
            }
Exemplo n.º 10
0
 private void CleanupServerQuery()
 {
     if (_serverQuery == HServerQuery.Invalid)
     {
         return;
     }
     SteamMatchmakingServers.CancelServerQuery(_serverQuery);
     _serverQuery = HServerQuery.Invalid;
 }
Exemplo n.º 11
0
 private void cleanupRulesQuery()
 {
     if (this.rulesQuery == HServerQuery.Invalid)
     {
         return;
     }
     SteamMatchmakingServers.CancelServerQuery(this.rulesQuery);
     this.rulesQuery = HServerQuery.Invalid;
 }
Exemplo n.º 12
0
 private void CancelServerQuery()
 {
     if (m_ServerQuery != HServerQuery.Invalid)
     {
         SteamMatchmakingServers.CancelServerQuery(m_ServerQuery);
         m_ServerQuery = HServerQuery.Invalid;
         print("SteamMatchmakingServers.CancelServerQuery(m_ServerQuery)");
     }
 }
Exemplo n.º 13
0
 private void StopRequest()
 {
     if (query == HServerQuery.Invalid)
     {
         return;
     }
     SteamMatchmakingServers.CancelServerQuery(query);
     query = HServerQuery.Invalid;
 }
Exemplo n.º 14
0
 public void Dispose()
 {
     if (_request != default(HServerListRequest))
     {
         SteamMatchmakingServers.CancelQuery(_request);
     }
     _refreshComplete.Dispose();
     _serverInfoReceived.Dispose();
 }
Exemplo n.º 15
0
 private void ReleaseRequest()
 {
     if (m_ServerListRequest != HServerListRequest.Invalid)
     {
         SteamMatchmakingServers.ReleaseRequest(m_ServerListRequest);
         m_ServerListRequest = HServerListRequest.Invalid;
         print("SteamMatchmakingServers.ReleaseRequest(m_ServerListRequest)");
     }
 }
Exemplo n.º 16
0
 private void cleanupServerListRequest()
 {
     if (this.serverListRequest == HServerListRequest.Invalid)
     {
         return;
     }
     SteamMatchmakingServers.ReleaseRequest(this.serverListRequest);
     this.serverListRequest      = HServerListRequest.Invalid;
     this.serverListRefreshIndex = -1;
 }
Exemplo n.º 17
0
    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);
        }
    }
Exemplo n.º 18
0
 private void attemptServerQuery()
 {
     this.cleanupServerQuery();
     this.serverQuery = SteamMatchmakingServers.PingServer(this.connectionInfo.ip, this.connectionInfo.port + 1, this.serverPingResponse);
     this.serverQueryAttempts++;
     if (this.onAttemptUpdated != null)
     {
         this.onAttemptUpdated(this.serverQueryAttempts);
     }
 }
Exemplo n.º 19
0
        public static bool BtnRefreshOnClick(UILobbyMainWndCtrl __instance)
        {
            if (__instance.mRoomListPage != 0 && __instance.mRoomListPage != 1)
            {
                return(false);
            }

            var lan = __instance.mRoomListPage == 1;

            var request = SteamServerHandler.currentInternetRequest;

            if (lan)
            {
                request = SteamServerHandler.currentLanRequest;
            }
            if (request == HServerListRequest.Invalid || !SteamMatchmakingServers.IsRefreshing(request))
            {
                if (lan)
                {
                    Traverse.Create(__instance).Field("_serverListLan").GetValue <List <ServerRegistered> >().Clear();
                }
                else
                {
                    Traverse.Create(__instance).Field("_serverListInter").GetValue <List <ServerRegistered> >().Clear();
                }
                typeof(UILobbyMainWndCtrl).GetMethod("RefreshRoomList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(__instance, new object[] { });


                if (request != HServerListRequest.Invalid)
                {
                    SteamMatchmakingServers.RefreshQuery(request);
                }
                else
                {
                    if (lan)
                    {
                        SteamServerHandler.currentLanRequest =
                            SteamMatchmakingServers.RequestLANServerList(new AppId_t(237870u),
                                                                         new ISteamMatchmakingServerListResponse(SteamServerHandler.ServerResponded, SteamServerHandler.ServerFailedToRespond, SteamServerHandler.RefreshComplete));
                    }
                    else
                    {
                        SteamServerHandler.currentInternetRequest =
                            SteamMatchmakingServers.RequestInternetServerList(new AppId_t(237870u), new MatchMakingKeyValuePair_t[] { new MatchMakingKeyValuePair_t()
                                                                                                                                      {
                                                                                                                                          m_szKey = "gametagsand", m_szValue = "public"
                                                                                                                                      } }, 1,
                                                                              new ISteamMatchmakingServerListResponse(SteamServerHandler.ServerResponded, SteamServerHandler.ServerFailedToRespond, SteamServerHandler.RefreshComplete));
                    }
                }
                SteamServerHandler.lastUpdate = true;
            }
            return(false);
        }
Exemplo n.º 20
0
        public void RefreshHistoryServers()
        {
            ReleaseRequest();
            searchType = SearchType.History;

            if (m_ServerListResponse == null)
            {
                m_ServerListResponse = new ISteamMatchmakingServerListResponse(OnServerResponded, OnServerFailedToRespond, OnRefreshComplete);
            }

            m_ServerListRequest = SteamMatchmakingServers.RequestHistoryServerList(steamSettings.applicationId, filter.ToArray(), System.Convert.ToUInt32(filter.Count), m_ServerListResponse);
        }
Exemplo n.º 21
0
        public void RefreshLANServers()
        {
            ReleaseRequest();
            searchType = SearchType.LAN;

            if (m_ServerListResponse == null)
            {
                m_ServerListResponse = new ISteamMatchmakingServerListResponse(OnServerResponded, OnServerFailedToRespond, OnRefreshComplete);
            }

            m_ServerListRequest = SteamMatchmakingServers.RequestLANServerList(steamSettings.applicationId, m_ServerListResponse);
        }
        public IServerInfoRequestHandle requestServerInfo(uint ip, ushort port, ServerInfoRequestReadyCallback callback)
        {
            SteamworksServerInfoRequestHandle steamworksServerInfoRequestHandle = new SteamworksServerInfoRequestHandle(callback);
            ISteamMatchmakingPingResponse     steamMatchmakingPingResponse      = new ISteamMatchmakingPingResponse(new ISteamMatchmakingPingResponse.ServerResponded(steamworksServerInfoRequestHandle.onServerResponded), new ISteamMatchmakingPingResponse.ServerFailedToRespond(steamworksServerInfoRequestHandle.onServerFailedToRespond));

            steamworksServerInfoRequestHandle.pingResponse = steamMatchmakingPingResponse;
            HServerQuery query = SteamMatchmakingServers.PingServer(ip, port + 1, steamMatchmakingPingResponse);

            steamworksServerInfoRequestHandle.query = query;
            SteamworksMatchmakingService.serverInfoRequestHandles.Add(steamworksServerInfoRequestHandle);
            return(steamworksServerInfoRequestHandle);
        }
Exemplo n.º 23
0
 private void FetchFavoritesServers()
 {
     this._response = new ISteamMatchmakingServerListResponse(new ISteamMatchmakingServerListResponse.ServerResponded(this.ServerResponded), new ISteamMatchmakingServerListResponse.ServerFailedToRespond(this.ServerFailedToRespond), new ISteamMatchmakingServerListResponse.RefreshComplete(this.RefreshComplete));
     this._request  = SteamMatchmakingServers.RequestFavoritesServerList(new AppId_t(242760u), new MatchMakingKeyValuePair_t[]
     {
         new MatchMakingKeyValuePair_t
         {
             m_szKey   = "gamedir",
             m_szValue = "TheForest"
         }
     }, 0u, this._response);
 }
Exemplo n.º 24
0
 // Token: 0x0600096F RID: 2415 RVA: 0x00045628 File Offset: 0x00043828
 private void RequestDedicatedServers()
 {
     if (this.m_haveListRequest)
     {
         SteamMatchmakingServers.ReleaseRequest(this.m_serverListRequest);
         this.m_haveListRequest = false;
     }
     this.m_dedicatedServers.Clear();
     this.m_serverListRequest          = SteamMatchmakingServers.RequestInternetServerList(SteamUtils.GetAppID(), new MatchMakingKeyValuePair_t[0], 0U, this.m_steamServerCallbackHandler);
     this.m_refreshingDedicatedServers = true;
     this.m_haveListRequest            = true;
 }
Exemplo n.º 25
0
        public List <string> GetPlayers()
        {
            if (cancellation.IsCancellationRequested)
            {
                return(players);
            }

            query = SteamMatchmakingServers.PlayerDetails(ip, (ushort)(port + 1), playersResponse);
            WaitHandle.WaitAny(new WaitHandle[] { reset, cancellation.WaitHandle });
            StopRequest();
            return(players);
        }
Exemplo n.º 26
0
        public void CancelRequest()
        {
            if (!SteamService.IsInitialized)
            {
                return;
            }

            if (_handle != HServerListRequest.Invalid)
            {
                SteamMatchmakingServers.ReleaseRequest(_handle);
                _handle = HServerListRequest.Invalid;
            }
        }
Exemplo n.º 27
0
    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();
        }
    }
Exemplo n.º 28
0
 internal static void RefreshComplete(HServerListRequest hRequest, EMatchMakingServerResponse response)
 {
     if (currentInternetRequest == hRequest)
     {
         UnityEngine.Debug.Log($"[STEAMWORKS] Internet RefreshComplete: {response}, num = {SteamMatchmakingServers.GetServerCount(hRequest)}");
         currentInternetRequest = HServerListRequest.Invalid;
         SteamMatchmakingServers.ReleaseRequest(hRequest);
     }
     if (currentLanRequest == hRequest)
     {
         UnityEngine.Debug.Log($"[STEAMWORKS] LAN RefreshComplete: {response}, num = {SteamMatchmakingServers.GetServerCount(hRequest)}");
         currentLanRequest = HServerListRequest.Invalid;
         SteamMatchmakingServers.ReleaseRequest(hRequest);
     }
 }
Exemplo n.º 29
0
            public async Task <int> GetServerList(uint appId, List <Tuple <string, string> > filter)
            {
                var r = RefreshComplete.Take(1).ToTask();

                await Schedule(() => _request = SteamMatchmakingServers.RequestInternetServerList(new AppId_t(appId),
                                                                                                  filter.Select(x => new MatchMakingKeyValuePair_t {
                    m_szKey = x.Item1, m_szValue = x.Item2
                })
                                                                                                  .ToArray(),
                                                                                                  (uint)filter.Count, _mServerListResponse));

                await r;

                return(_resultsReceived);
            }
Exemplo n.º 30
0
        internal static void ServerResponded(HServerListRequest hRequest, int iServer)
        {
            if (UILobbyMainWndCtrl.Instance != null)
            {
                var details = SteamMatchmakingServers.GetServerDetails(hRequest, iServer);
                var tags    = details.GetGameTags()?.Split(',');
                if (tags != null && (tags.Length == 6 || tags.Length == 7))
                {
                    var server = new ServerRegisteredLocal()
                    {
                        PasswordStatus   = details.m_bPassword ? 1 : 0,
                        ServerUID        = 0L,
                        ServerID         = iServer,
                        ServerName       = details.GetServerName(),
                        ServerMasterName = string.Empty,
                        CurConn          = 0,
                        LimitedConn      = details.m_nMaxPlayers,
                        GameType         = 0,
                        GameMode         = 0,
                        Ping             = details.m_nPing,
                        ServerStatus     = details.m_nBotPlayers,
                        ServerVersion    = details.m_nServerVersion.ToString(),
                        MapName          = details.GetMap(),

                        IsLan     = false,
                        IPAddress = details.m_NetAdr.GetConnectionAddressString().Split(':')[0],
                        Port      = details.m_NetAdr.GetConnectionPort()
                    };

                    server.GameType         = (int)(Pathea.PeGameMgr.EGameType)Enum.Parse(typeof(Pathea.PeGameMgr.EGameType), tags[0]);
                    server.GameMode         = (int)(Pathea.PeGameMgr.ESceneMode)Enum.Parse(typeof(Pathea.PeGameMgr.ESceneMode), tags[1]);
                    server.ServerUID        = long.Parse(tags[2], System.Globalization.NumberStyles.HexNumber);
                    server.ServerStatus     = int.Parse(tags[3]);
                    server.CurConn          = int.Parse(tags[4]);
                    server.ServerMasterName = tags[5];
                    if (hRequest == currentInternetRequest)
                    {
                        Traverse.Create(UILobbyMainWndCtrl.Instance).Field("_serverListInter").GetValue <List <ServerRegistered> >().Add(server.ToServerRegistered());
                    }
                    if (hRequest == currentLanRequest)
                    {
                        Traverse.Create(UILobbyMainWndCtrl.Instance).Field("_serverListLan").GetValue <List <ServerRegistered> >().Add(server.ToServerRegistered());
                    }
                }
            }
        }