diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index 677dfaa..a518892 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -62,6 +62,7 @@ public partial class Client : BaseSteamworks public MicroTransactions MicroTransactions { get; private set; } public User User { get; private set; } public RemoteStorage RemoteStorage { get; private set; } + public Overlay Overlay { get; private set; } public Client( uint appId ) : base( appId ) { @@ -107,6 +108,7 @@ public Client( uint appId ) : base( appId ) MicroTransactions = new MicroTransactions( this ); User = new User( this ); RemoteStorage = new RemoteStorage( this ); + Overlay = new Overlay( this ); Workshop.friends = Friends; diff --git a/Facepunch.Steamworks/Client/Overlay.cs b/Facepunch.Steamworks/Client/Overlay.cs index 73da7fd..c322ff9 100644 --- a/Facepunch.Steamworks/Client/Overlay.cs +++ b/Facepunch.Steamworks/Client/Overlay.cs @@ -2,25 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using SteamNative; namespace Facepunch.Steamworks { - public partial class Client : IDisposable - { - private Overlay _overlay; - - public Overlay Overlay - { - get - { - if ( _overlay == null ) - _overlay = new Overlay { client = this }; - - return _overlay; - } - } - } - public class Overlay { internal Client client; @@ -30,6 +15,20 @@ public bool Enabled get { return client.native.utils.IsOverlayEnabled(); } } + public bool IsOpen { get; private set; } + + internal Overlay( Client c ) + { + client = c; + + c.RegisterCallback( OverlayStateChange ); + } + + private void OverlayStateChange( GameOverlayActivated_t activation ) + { + IsOpen = activation.Active == 1; + } + public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); } public void OpenProfile( ulong steamid ) { OpenUserPage( "steamid", steamid ); }