// Token: 0x06001A7A RID: 6778 RVA: 0x0007D3C4 File Offset: 0x0007B5C4
        private static void OnLobbyDataUpdated()
        {
            Lobby lobby = SteamworksLobbyManager.client.Lobby;

            SteamworksLobbyManager.newestLobbyData = (lobby.IsValid ? new SteamworksLobbyManager.LobbyData(lobby.CurrentLobbyData) : new SteamworksLobbyManager.LobbyData());
            SteamworksLobbyManager.UpdateOwnsLobby();
            SteamworksLobbyManager.UpdatePlayerCount();
            if (lobby.IsValid && !SteamworksLobbyManager.ownsLobby)
            {
                if (SteamworksLobbyManager.newestLobbyData.serverId.isValid)
                {
                    if (!GameNetworkManager.singleton.IsConnectedToServer(SteamworksLobbyManager.newestLobbyData.serverId) && RoR2Application.GetBuildId() == SteamworksLobbyManager.newestLobbyData.buildId)
                    {
                        GameNetworkManager.singleton.desiredHost = new GameNetworkManager.HostDescription(SteamworksLobbyManager.newestLobbyData.serverId);
                    }
                }
                else
                {
                    GameNetworkManager.singleton.desiredHost = GameNetworkManager.HostDescription.none;
                }
            }
            Action action = SteamworksLobbyManager.onLobbyDataUpdated;

            if (action == null)
            {
                return;
            }
            action();
        }
示例#2
0
 // Token: 0x06001AF5 RID: 6901 RVA: 0x0007ECCC File Offset: 0x0007CECC
 private static void OnInvitedToGame(SteamFriend steamFriend, string connectString)
 {
     Debug.LogFormat("OnGameRichPresenceJoinRequested connectString=\"{0}\" steamFriend=\"{1}\"", new object[]
     {
         connectString,
         steamFriend.Name
     });
     string[] array = connectString.Split(new char[]
     {
         ' '
     });
     if (array.Length >= 2)
     {
         CSteamID csteamID;
         if (array[0] == "+connect_steamworks_p2p" && CSteamID.TryParse(array[1], out csteamID))
         {
             if (!SteamworksLobbyManager.ownsLobby)
             {
                 SteamworksLobbyManager.LeaveLobby();
             }
             Console.instance.SubmitCmd(null, "connect_steamworks_p2p " + csteamID.value, false);
         }
         CSteamID csteamID2;
         if (array[0] == "+steam_lobby_join" && CSteamID.TryParse(array[1], out csteamID2))
         {
             if (!SteamworksLobbyManager.ownsLobby)
             {
                 SteamworksLobbyManager.LeaveLobby();
             }
             Console.instance.SubmitCmd(null, "steam_lobby_join " + csteamID2.value, false);
         }
     }
 }
 // Token: 0x06001A90 RID: 6800 RVA: 0x0007DA90 File Offset: 0x0007BC90
 public static void SendMigrationMessage(CSteamID newLobbyId)
 {
     if (SteamworksLobbyManager.client != null)
     {
         SteamworksLobbyManager.client.Lobby.SendChatMessage("");
         SteamworksLobbyManager.JoinLobby(newLobbyId);
     }
 }
 private static void CCSteamLobbyCreateIfNone(ConCommandArgs args)
 {
     ConCommandException.CheckSteamworks();
     if (!SteamworksLobbyManager.client.Lobby.IsValid)
     {
         SteamworksLobbyManager.CreateLobby();
     }
 }
 // Token: 0x06001A64 RID: 6756 RVA: 0x0007CE21 File Offset: 0x0007B021
 private static void StaticUpdate()
 {
     if (SteamworksLobbyManager.client == null)
     {
         return;
     }
     SteamworksLobbyManager.UpdateOwnsLobby();
 }
 // Token: 0x06001A88 RID: 6792 RVA: 0x0007D847 File Offset: 0x0007BA47
 private static void OnLobbyJoinRequested(ulong lobbyId)
 {
     Debug.LogFormat("Request to join lobby {0} received. Attempting to join lobby.", new object[]
     {
         lobbyId
     });
     SteamworksLobbyManager.JoinLobby(new CSteamID(lobbyId));
 }
 // Token: 0x06001A81 RID: 6785 RVA: 0x0007D6DC File Offset: 0x0007B8DC
 private static void OnLobbyKicked(bool kickedDueToDisconnect, ulong lobbyId, ulong adminId)
 {
     Debug.LogFormat("Kicked from lobby. kickedDueToDisconnect={0} lobbyId={1} adminId={2}", new object[]
     {
         kickedDueToDisconnect,
         lobbyId,
         adminId
     });
     SteamworksLobbyManager.OnLobbyChanged();
 }
 // Token: 0x06001A75 RID: 6773 RVA: 0x0007D2C3 File Offset: 0x0007B4C3
 public static void JoinOrStartMigrate(CSteamID newLobbyId)
 {
     if (SteamworksLobbyManager.ownsLobby)
     {
         SteamworksLobbyManager.StartMigrateLobby(newLobbyId);
         return;
     }
     SteamworksLobbyManager.client.Lobby.Leave();
     SteamworksLobbyManager.JoinLobby(newLobbyId);
 }
        // Token: 0x06001A7D RID: 6781 RVA: 0x0007D4F8 File Offset: 0x0007B6F8
        private static void OnLobbyJoined(bool success)
        {
            SteamworksLobbyManager.awaitingJoin = false;
            if (success)
            {
                if (SteamworksLobbyManager.client.Lobby.CurrentLobbyData != null)
                {
                    string buildId = RoR2Application.GetBuildId();
                    string data    = SteamworksLobbyManager.client.Lobby.CurrentLobbyData.GetData("build_id");
                    if (buildId != data)
                    {
                        Debug.LogFormat("Lobby build_id mismatch, leaving lobby. Ours=\"{0}\" Theirs=\"{1}\"", new object[]
                        {
                            buildId,
                            data
                        });
                        SimpleDialogBox simpleDialogBox = SimpleDialogBox.Create(null);
                        simpleDialogBox.AddCancelButton(CommonLanguageTokens.ok, Array.Empty <object>());
                        simpleDialogBox.headerToken = new SimpleDialogBox.TokenParamsPair
                        {
                            token        = "STEAM_LOBBY_VERSION_MISMATCH_DIALOG_TITLE",
                            formatParams = Array.Empty <object>()
                        };
                        SimpleDialogBox.TokenParamsPair descriptionToken = default(SimpleDialogBox.TokenParamsPair);
                        descriptionToken.token = "STEAM_LOBBY_VERSION_MISMATCH_DIALOG_DESCRIPTION";
                        object[] formatParams = new string[]
                        {
                            buildId,
                            data
                        };
                        descriptionToken.formatParams    = formatParams;
                        simpleDialogBox.descriptionToken = descriptionToken;
                        SteamworksLobbyManager.client.Lobby.Leave();
                        return;
                    }
                }
                Debug.LogFormat("Steamworks lobby join succeeded. Lobby id = {0}", new object[]
                {
                    SteamworksLobbyManager.client.Lobby.CurrentLobby
                });
                SteamworksLobbyManager.OnLobbyChanged();
            }
            else
            {
                Debug.Log("Steamworks lobby join failed.");
                Console.instance.SubmitCmd(null, "steam_lobby_create_if_none", true);
            }
            Action <bool> action = SteamworksLobbyManager.onLobbyJoined;

            if (action == null)
            {
                return;
            }
            action(success);
        }
        // Token: 0x06001A84 RID: 6788 RVA: 0x0007D777 File Offset: 0x0007B977
        private static void OnLobbyMemberDataUpdated(ulong memberId)
        {
            SteamworksLobbyManager.UpdateOwnsLobby();
            Action <ulong> action = SteamworksLobbyManager.onLobbyMemberDataUpdated;

            if (action == null)
            {
                return;
            }
            action(memberId);
        }
示例#11
0
 // Token: 0x06001AF6 RID: 6902 RVA: 0x0007EDA1 File Offset: 0x0007CFA1
 private static void OnGameServerChangeRequested(string address, string password)
 {
     Debug.LogFormat("OnGameServerChangeRequested address=\"{0}\"", new object[]
     {
         address
     });
     if (!SteamworksLobbyManager.ownsLobby)
     {
         SteamworksLobbyManager.LeaveLobby();
     }
     Console.instance.SubmitCmd(null, string.Format("connect \"{0}\"", address), false);
 }
 // Token: 0x06001A77 RID: 6775 RVA: 0x0007D31F File Offset: 0x0007B51F
 private static void OnLobbyCreated(bool success)
 {
     if (success)
     {
         Debug.LogFormat("Steamworks lobby creation succeeded. Lobby id = {0}", new object[]
         {
             SteamworksLobbyManager.client.Lobby.CurrentLobby
         });
         SteamworksLobbyManager.OnLobbyChanged();
         return;
     }
     Debug.Log("Steamworks lobby creation failed.");
 }
        // Token: 0x06001A5C RID: 6748 RVA: 0x0007081C File Offset: 0x0006EA1C
        private static void OnGameServerChangeRequested(string address, string password)
        {
            Debug.LogFormat("OnGameServerChangeRequested address=\"{0}\"", new object[]
            {
                address
            });
            if (!SteamworksLobbyManager.ownsLobby)
            {
                SteamworksLobbyManager.LeaveLobby();
            }
            string consoleCmd = string.Format("cl_password \"{0}\"; connect \"{1}\"", Util.EscapeQuotes(password), Util.EscapeQuotes(address));

            QuitConfirmationHelper.IssueQuitCommand(null, consoleCmd);
        }
        // Token: 0x06001A80 RID: 6784 RVA: 0x0007D6AB File Offset: 0x0007B8AB
        private static void OnLobbyLeave(ulong lobbyId)
        {
            Debug.LogFormat("Left lobby {0}.", new object[]
            {
                lobbyId
            });
            Action <ulong> action = SteamworksLobbyManager.onLobbyLeave;

            if (action != null)
            {
                action(lobbyId);
            }
            SteamworksLobbyManager.OnLobbyChanged();
        }
 // Token: 0x06001A53 RID: 6739 RVA: 0x0007C8CC File Offset: 0x0007AACC
 public static void SetupCallbacks(Client client)
 {
     client.Lobby.OnChatMessageRecieved    = new Action <ulong, byte[], int>(SteamworksLobbyManager.OnChatMessageReceived);
     client.Lobby.OnLobbyCreated           = new Action <bool>(SteamworksLobbyManager.OnLobbyCreated);
     client.Lobby.OnLobbyDataUpdated       = new Action(SteamworksLobbyManager.OnLobbyDataUpdated);
     client.Lobby.OnLobbyJoined            = new Action <bool>(SteamworksLobbyManager.OnLobbyJoined);
     client.Lobby.OnLobbyMemberDataUpdated = new Action <ulong>(SteamworksLobbyManager.OnLobbyMemberDataUpdated);
     client.Lobby.OnLobbyStateChanged      = new Action <Lobby.MemberStateChange, ulong, ulong>(SteamworksLobbyManager.OnLobbyStateChanged);
     client.Lobby.OnLobbyKicked            = new Action <bool, ulong, ulong>(SteamworksLobbyManager.OnLobbyKicked);
     client.Lobby.OnLobbyLeave             = new Action <ulong>(SteamworksLobbyManager.OnLobbyLeave);
     client.Lobby.OnUserInvitedToLobby     = new Action <ulong, ulong>(SteamworksLobbyManager.OnUserInvitedToLobby);
     client.Lobby.OnLobbyJoinRequested     = new Action <ulong>(SteamworksLobbyManager.OnLobbyJoinRequested);
     client.LobbyList.OnLobbiesUpdated     = new Action(SteamworksLobbyManager.OnLobbiesUpdated);
     RoR2Application.onUpdate += SteamworksLobbyManager.StaticUpdate;
     SteamworksLobbyManager.SetStartingIfOwner(false);
 }
示例#16
0
 // Token: 0x0600199F RID: 6559 RVA: 0x0006DE78 File Offset: 0x0006C078
 private SteamworksClientManager()
 {
     if (!Application.isEditor && File.Exists("steam_appid.txt"))
     {
         try
         {
             File.Delete("steam_appid.txt");
         }
         catch (Exception ex)
         {
             Debug.Log(ex.Message);
         }
         if (File.Exists("steam_appid.txt"))
         {
             Debug.Log("Cannot delete steam_appid.txt. Quitting...");
             this.Dispose();
             return;
         }
     }
     Config.ForUnity(Application.platform.ToString());
     this.steamworksClient = new Client(632360U);
     if (!this.steamworksClient.IsValid)
     {
         this.Dispose();
         return;
     }
     if (!Application.isEditor)
     {
         if (Client.RestartIfNecessary(632360U) || !this.steamworksClient.IsValid || !SteamApiValidator.IsValidSteamApiDll())
         {
             Debug.Log("Unable to initialize Facepunch.Steamworks.");
             this.Dispose();
             return;
         }
         if (!this.steamworksClient.App.IsSubscribed(632360U))
         {
             Debug.Log("Steam user not subscribed to app. Quitting...");
             this.Dispose();
             return;
         }
     }
     RoR2Application.steamBuildId = TextSerialization.ToStringInvariant(this.steamworksClient.BuildId);
     RoR2Application.onUpdate    += this.Update;
     RoR2Application.cloudStorage = new SteamworksRemoteStorageFileSystem();
     SteamworksLobbyManager.Init();
     SteamLobbyFinder.Init();
 }
        private static void CCSteamLobbyJoin(ConCommandArgs args)
        {
            ConCommandException.CheckSteamworks();
            args.CheckArgumentCount(1);
            Debug.LogFormat("Joining lobby {0}...", new object[]
            {
                args[0]
            });
            CSteamID newLobbyId;

            if (CSteamID.TryParse(args[0], out newLobbyId))
            {
                SteamworksLobbyManager.JoinLobby(newLobbyId);
                return;
            }
            throw new ConCommandException("Could not parse lobby id.");
        }
        // Token: 0x06001A87 RID: 6791 RVA: 0x0007D7F8 File Offset: 0x0007B9F8
        private static void OnLobbyStateChanged(Lobby.MemberStateChange memberStateChange, ulong initiatorUserId, ulong affectedUserId)
        {
            Debug.LogFormat("OnLobbyStateChanged memberStateChange={0} initiatorUserId={1} affectedUserId={2}", new object[]
            {
                memberStateChange,
                initiatorUserId,
                affectedUserId
            });
            SteamworksLobbyManager.OnLobbyChanged();
            Action <Lobby.MemberStateChange, ulong, ulong> action = SteamworksLobbyManager.onLobbyStateChanged;

            if (action == null)
            {
                return;
            }
            action(memberStateChange, initiatorUserId, affectedUserId);
        }
        // Token: 0x06001A5D RID: 6749 RVA: 0x0007CCB0 File Offset: 0x0007AEB0
        private static void OnLobbyChanged()
        {
            SteamworksLobbyManager.isInLobby = SteamworksLobbyManager.client.Lobby.IsValid;
            SteamworksLobbyManager.UpdateOwnsLobby();
            if (SteamworksLobbyManager.client.Lobby.CurrentLobbyData != null)
            {
                SteamworksLobbyManager.client.Lobby.CurrentLobbyData.SetData("total_max_players", TextSerialization.ToStringInvariant(RoR2Application.maxPlayers));
                SteamworksLobbyManager.client.Lobby.CurrentLobbyData.SetData("build_id", RoR2Application.GetBuildId());
            }
            SteamworksLobbyManager.UpdatePlayerCount();
            Action action = SteamworksLobbyManager.onLobbyChanged;

            if (action != null)
            {
                action();
            }
            SteamworksLobbyManager.OnLobbyDataUpdated();
        }
 private static void Init()
 {
     SteamworksLobbyManager.newestLobbyData = new SteamworksLobbyManager.LobbyData();
     LocalUserManager.onLocalUsersUpdated  += SteamworksLobbyManager.UpdatePlayerCount;
     GameNetworkManager.onStopClientGlobal += delegate()
     {
         NetworkConnection connection = GameNetworkManager.singleton.client.connection;
         bool flag = Util.ConnectionIsLocal(connection);
         bool flag2;
         if (connection is SteamNetworkConnection)
         {
             flag2 = (((SteamNetworkConnection)connection).steamId == SteamworksLobbyManager.newestLobbyData.serverId);
         }
         else
         {
             flag2 = (connection.address == SteamworksLobbyManager.newestLobbyData.serverAddressPortPair.address);
         }
         if (flag && SteamworksLobbyManager.ownsLobby)
         {
             SteamworksLobbyManager.client.Lobby.CurrentLobbyData.RemoveData("server_id");
         }
         if (!flag && flag2)
         {
             SteamworksLobbyManager.client.Lobby.Leave();
         }
     };
     GameNetworkManager.onStartClientGlobal += delegate(NetworkClient networkClient)
     {
         if (SteamworksLobbyManager.ownsLobby)
         {
             SteamworksLobbyManager.client.Lobby.LobbyType = SteamworksLobbyManager.preferredLobbyType;
         }
     };
     SteamworksLobbyManager.onLobbyOwnershipGained += delegate()
     {
         SteamworksLobbyManager.SetStartingIfOwner(false);
     };
     GameNetworkManager.onStopClientGlobal += delegate()
     {
         SteamworksLobbyManager.SetStartingIfOwner(false);
     };
 }
示例#21
0
 // Token: 0x06001A45 RID: 6725 RVA: 0x0007C771 File Offset: 0x0007A971
 public static void Init(Client client)
 {
     SteamworksLobbyManager.SetupCallbacks(client);
 }
 private static void CCSteamLobbyLeave(ConCommandArgs args)
 {
     ConCommandException.CheckSteamworks();
     SteamworksLobbyManager.LeaveLobby();
 }
 private static void CCSteamLobbyUpdatePlayerCount(ConCommandArgs args)
 {
     SteamworksLobbyManager.UpdatePlayerCount();
 }