From 5f3ed7467a8776482a863c9040d65433d4343fcd Mon Sep 17 00:00:00 2001 From: Lukasz Taborski Date: Thu, 27 Sep 2018 13:03:15 +0200 Subject: [PATCH] Removed unnecessary check for InitClient allowing wrapper to initialize when in offline mode. Exposed LoggedOn property to manually check the client if it's connected and logged on to the (online) Steam servers. --- Facepunch.Steamworks/Client.cs | 7 +++++++ Facepunch.Steamworks/Interop/Native.cs | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index 677dfaa..177e03d 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -254,6 +254,13 @@ public Leaderboard GetLeaderboard( string name, LeaderboardSortMethod sortMethod return board; } + /// + /// Checks if the current user's Steam client is connected and logged on to the Steam servers. + /// If it's not then no real-time services provided by the Steamworks API will be enabled. + /// The Steam client will automatically be trying to recreate the connection as often as possible. + /// All of the API calls that rely on this will check internally. + /// + public bool IsLoggedOn => native.user.BLoggedOn(); /// /// True if we're subscribed/authorised to be running this app diff --git a/Facepunch.Steamworks/Interop/Native.cs b/Facepunch.Steamworks/Interop/Native.cs index 3bfebc2..6ff8939 100644 --- a/Facepunch.Steamworks/Interop/Native.cs +++ b/Facepunch.Steamworks/Interop/Native.cs @@ -60,14 +60,6 @@ internal bool InitClient( BaseSteamworks steamworks ) return false; } - // Ensure that the user has logged into Steam. This will always return true if the game is launched - // from Steam, but if Steam is at the login prompt when you run your game it will return false. - if ( !user.BLoggedOn() ) - { - Console.Error.WriteLine( "InitClient: Not Logged On" ); - return false; - } - return true; }