private static void DumpLobbies(ConCommandArgs args)
 {
     LobbyList.Filter filter = new LobbyList.Filter();
     filter.MaxResults     = new int?(50);
     filter.DistanceFilter = LobbyList.Filter.Distance.Worldwide;
     SteamworksLobbyManager.client.LobbyList.Refresh(filter);
 }
Beispiel #2
0
        public void RefreshLobbyListWithFilterAndGetLobbyDataFromListLobby()
        {
            using (var client = new Facepunch.Steamworks.Client(755870))
            {
                Assert.IsTrue(client.IsValid);

                client.Lobby.OnLobbyCreated = (success) =>
                {
                    Assert.IsTrue(success);
                    Assert.IsTrue(client.Lobby.IsValid);
                    Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
                    client.Lobby.CurrentLobbyData.SetData("testkey", "testvalue");
                };

                client.Lobby.OnLobbyDataUpdated = () =>
                {
                    var filter = new LobbyList.Filter();
                    filter.StringFilters.Add("testkey", "testvalue");
                    client.LobbyList.Refresh(filter);
                };

                client.LobbyList.OnLobbiesUpdated = () =>
                {
                    Console.WriteLine("lobbies updating");
                    if (client.LobbyList.Finished)
                    {
                        Console.WriteLine("lobbies finished updating");
                        Console.WriteLine($"found {client.LobbyList.Lobbies.Count} lobbies");

                        foreach (LobbyList.Lobby lobby in client.LobbyList.Lobbies)
                        {
                            foreach (var pair in lobby.GetAllData())
                            {
                                Console.WriteLine(string.Format("Key: {0,-36} Value: {1}", pair.Key, pair.Value));
                            }
                        }
                    }
                };

                client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);

                var sw = Stopwatch.StartNew();

                while (sw.Elapsed.TotalSeconds < 5)
                {
                    client.Update();
                    System.Threading.Thread.Sleep(10);
                }

                client.Lobby.Leave();
            }
        }
Beispiel #3
0
 // Token: 0x06001FF9 RID: 8185 RVA: 0x00096600 File Offset: 0x00094800
 private static void RequestLobbyListRefresh()
 {
     if (SteamLobbyFinder.awaitingLobbyRefresh)
     {
         return;
     }
     SteamLobbyFinder.awaitingLobbyRefresh = true;
     LobbyList.Filter filter = new LobbyList.Filter();
     filter.StringFilters["appid"]             = TextSerialization.ToStringInvariant(SteamLobbyFinder.steamClient.AppId);
     filter.StringFilters["build_id"]          = RoR2Application.GetBuildId();
     filter.StringFilters["qp"]                = "1";
     filter.StringFilters["total_max_players"] = TextSerialization.ToStringInvariant(RoR2Application.maxPlayers);
     LobbyList.Filter filter2 = filter;
     SteamLobbyFinder.steamClient.LobbyList.Refresh(filter2);
 }