Exemplo n.º 1
0
        public void AddFilter(string key, string value)
        {
            List <MatchMakingKeyValuePair_t> matchMakingKeyValuePairTs = this.filters;
            MatchMakingKeyValuePair_t        matchMakingKeyValuePairT  = new MatchMakingKeyValuePair_t()
            {
                Key   = key,
                Value = value
            };

            matchMakingKeyValuePairTs.Add(matchMakingKeyValuePairT);
        }
Exemplo n.º 2
0
        public void refreshMasterServer(ESteamServerList list, string filterMap, EPassword filterPassword, EWorkshop filterWorkshop, EPlugins filterPlugins, EAttendance filterAttendance, EVACProtectionFilter filterVACProtection, EBattlEyeProtectionFilter filterBattlEyeProtection, bool filterPro, ECombat filterCombat, ECheats filterCheats, EGameMode filterMode, ECameraMode filterCamera)
        {
            this._currentList = list;
            if (this.onMasterServerRemoved != null)
            {
                this.onMasterServerRemoved();
            }
            this.cleanupServerListRequest();
            this._serverList = new List <SteamServerInfo>();
            if (list == ESteamServerList.HISTORY)
            {
                this.serverListRequest = SteamMatchmakingServers.RequestHistoryServerList(Provider.APP_ID, new MatchMakingKeyValuePair_t[0], 0u, this.serverListResponse);
                return;
            }
            if (list == ESteamServerList.FAVORITES)
            {
                this.serverListRequest = SteamMatchmakingServers.RequestFavoritesServerList(Provider.APP_ID, new MatchMakingKeyValuePair_t[0], 0u, this.serverListResponse);
                return;
            }
            if (list == ESteamServerList.LAN)
            {
                this.serverListRequest = SteamMatchmakingServers.RequestLANServerList(Provider.APP_ID, this.serverListResponse);
                return;
            }
            this.filters = new List <MatchMakingKeyValuePair_t>();
            MatchMakingKeyValuePair_t item = default(MatchMakingKeyValuePair_t);

            item.m_szKey   = "gamedir";
            item.m_szValue = "unturned";
            this.filters.Add(item);
            if (filterMap.Length > 0)
            {
                MatchMakingKeyValuePair_t item2 = default(MatchMakingKeyValuePair_t);
                item2.m_szKey   = "map";
                item2.m_szValue = filterMap.ToLower();
                this.filters.Add(item2);
            }
            if (filterAttendance == EAttendance.EMPTY)
            {
                MatchMakingKeyValuePair_t item3 = default(MatchMakingKeyValuePair_t);
                item3.m_szKey   = "noplayers";
                item3.m_szValue = "1";
                this.filters.Add(item3);
            }
            else if (filterAttendance == EAttendance.SPACE)
            {
                MatchMakingKeyValuePair_t item4 = default(MatchMakingKeyValuePair_t);
                item4.m_szKey   = "notfull";
                item4.m_szValue = "1";
                this.filters.Add(item4);
                MatchMakingKeyValuePair_t item5 = default(MatchMakingKeyValuePair_t);
                item5.m_szKey   = "hasplayers";
                item5.m_szValue = "1";
                this.filters.Add(item5);
            }
            MatchMakingKeyValuePair_t item6 = default(MatchMakingKeyValuePair_t);

            item6.m_szKey = "gamedataand";
            if (filterPassword == EPassword.YES)
            {
                item6.m_szValue = "PASS";
            }
            else if (filterPassword == EPassword.NO)
            {
                item6.m_szValue = "SSAP";
            }
            if (filterVACProtection == EVACProtectionFilter.Secure)
            {
                item6.m_szValue += ",";
                item6.m_szValue += "VAC_ON";
                MatchMakingKeyValuePair_t item7 = default(MatchMakingKeyValuePair_t);
                item7.m_szKey   = "secure";
                item7.m_szValue = "1";
                this.filters.Add(item7);
            }
            else if (filterVACProtection == EVACProtectionFilter.Insecure)
            {
                item6.m_szValue += ",";
                item6.m_szValue += "VAC_OFF";
            }
            item6.m_szValue += ",";
            item6.m_szValue += Provider.APP_VERSION;
            this.filters.Add(item6);
            MatchMakingKeyValuePair_t item8 = default(MatchMakingKeyValuePair_t);

            item8.m_szKey = "gametagsand";
            if (filterWorkshop == EWorkshop.YES)
            {
                item8.m_szValue = "WORK";
            }
            else if (filterWorkshop == EWorkshop.NO)
            {
                item8.m_szValue = "KROW";
            }
            if (filterCombat == ECombat.PVP)
            {
                item8.m_szValue += ",PVP";
            }
            else if (filterCombat == ECombat.PVE)
            {
                item8.m_szValue += ",PVE";
            }
            if (filterCheats == ECheats.YES)
            {
                item8.m_szValue += ",CHEATS";
            }
            else if (filterCheats == ECheats.NO)
            {
                item8.m_szValue += ",STAEHC";
            }
            if (filterMode != EGameMode.ANY)
            {
                item8.m_szValue = item8.m_szValue + "," + filterMode.ToString();
            }
            if (filterCamera != ECameraMode.ANY)
            {
                item8.m_szValue = item8.m_szValue + "," + filterCamera.ToString();
            }
            if (filterPro)
            {
                item8.m_szValue += ",GOLDONLY";
            }
            else
            {
                item8.m_szValue += ",YLNODLOG";
            }
            if (filterBattlEyeProtection == EBattlEyeProtectionFilter.Secure)
            {
                item8.m_szValue += ",BATTLEYE_ON";
            }
            else if (filterBattlEyeProtection == EBattlEyeProtectionFilter.Insecure)
            {
                item8.m_szValue += ",BATTLEYE_OFF";
            }
            this.filters.Add(item8);
            if (list == ESteamServerList.INTERNET)
            {
                this.serverListRequest = SteamMatchmakingServers.RequestInternetServerList(Provider.APP_ID, this.filters.ToArray(), (uint)this.filters.Count, this.serverListResponse);
                return;
            }
            if (list == ESteamServerList.FRIENDS)
            {
                this.serverListRequest = SteamMatchmakingServers.RequestFriendsServerList(Provider.APP_ID, this.filters.ToArray(), (uint)this.filters.Count, this.serverListResponse);
                return;
            }
        }
Exemplo n.º 3
0
    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.
        }
    }
Exemplo n.º 4
0
 public override uint RequestSpectatorServerList(uint iApp,MatchMakingKeyValuePair_t  [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse)
 {
     CheckIfUsable();
     uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr());
     return result;
 }
Exemplo n.º 5
0
 public abstract uint RequestSpectatorServerList(uint iApp,MatchMakingKeyValuePair_t  [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse);