Add Overlay.IsOpen

This commit is contained in:
Rohan Singh 2018-12-04 13:39:47 -05:00
parent 971751f89d
commit 80a383730b
2 changed files with 17 additions and 16 deletions

View File

@ -62,6 +62,7 @@ public partial class Client : BaseSteamworks
public MicroTransactions MicroTransactions { get; private set; } public MicroTransactions MicroTransactions { get; private set; }
public User User { get; private set; } public User User { get; private set; }
public RemoteStorage RemoteStorage { get; private set; } public RemoteStorage RemoteStorage { get; private set; }
public Overlay Overlay { get; private set; }
public Client( uint appId ) : base( appId ) public Client( uint appId ) : base( appId )
{ {
@ -107,6 +108,7 @@ public Client( uint appId ) : base( appId )
MicroTransactions = new MicroTransactions( this ); MicroTransactions = new MicroTransactions( this );
User = new User( this ); User = new User( this );
RemoteStorage = new RemoteStorage( this ); RemoteStorage = new RemoteStorage( this );
Overlay = new Overlay( this );
Workshop.friends = Friends; Workshop.friends = Friends;

View File

@ -2,25 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using SteamNative;
namespace Facepunch.Steamworks 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 public class Overlay
{ {
internal Client client; internal Client client;
@ -30,6 +15,20 @@ public bool Enabled
get { return client.native.utils.IsOverlayEnabled(); } get { return client.native.utils.IsOverlayEnabled(); }
} }
public bool IsOpen { get; private set; }
internal Overlay( Client c )
{
client = c;
c.RegisterCallback<GameOverlayActivated_t>( 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 OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); }
public void OpenProfile( ulong steamid ) { OpenUserPage( "steamid", steamid ); } public void OpenProfile( ulong steamid ) { OpenUserPage( "steamid", steamid ); }