diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index 54213ac..17c98ba 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -65,7 +65,6 @@ 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 ) { @@ -109,7 +108,6 @@ 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 deleted file mode 100644 index 60d87f9..0000000 --- a/Facepunch.Steamworks/Client/Overlay.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using SteamNative; - -namespace Facepunch.Steamworks -{ - public class Overlay - { - internal Client client; - - 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 ); } - public void OpenChat( ulong steamid ){ OpenUserPage( "chat", steamid ); } - public void OpenTrade( ulong steamid ) { OpenUserPage( "jointrade", steamid ); } - public void OpenStats( ulong steamid ) { OpenUserPage( "stats", steamid ); } - public void OpenAchievements( ulong steamid ) { OpenUserPage( "achievements", steamid ); } - public void AddFriend( ulong steamid ) { OpenUserPage( "friendadd", steamid ); } - public void RemoveFriend( ulong steamid ) { OpenUserPage( "friendremove", steamid ); } - public void AcceptFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestaccept", steamid ); } - public void IgnoreFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestignore", steamid ); } - - public void OpenUrl( string url, bool modal = false ) { client.native.friends.ActivateGameOverlayToWebPage( url, modal ? ActivateGameOverlayToWebPageMode.Modal : ActivateGameOverlayToWebPageMode.Default ); } - } -} diff --git a/Facepunch.Steamworks/Redux/Friends.cs b/Facepunch.Steamworks/Redux/Friends.cs index 7310e5c..25fa758 100644 --- a/Facepunch.Steamworks/Redux/Friends.cs +++ b/Facepunch.Steamworks/Redux/Friends.cs @@ -67,7 +67,51 @@ public static IEnumerable GetPlayedWith() } } + /// + /// The dialog to open. Valid options are: + /// "friends", + /// "community", + /// "players", + /// "settings", + /// "officialgamegroup", + /// "stats", + /// "achievements". + /// + public static void OpenOverlay( string type ) => Internal.ActivateGameOverlay( type ); + /// + /// "steamid" - Opens the overlay web browser to the specified user or groups profile. + /// "chat" - Opens a chat window to the specified user, or joins the group chat. + /// "jointrade" - Opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API. + /// "stats" - Opens the overlay web browser to the specified user's stats. + /// "achievements" - Opens the overlay web browser to the specified user's achievements. + /// "friendadd" - Opens the overlay in minimal mode prompting the user to add the target user as a friend. + /// "friendremove" - Opens the overlay in minimal mode prompting the user to remove the target friend. + /// "friendrequestaccept" - Opens the overlay in minimal mode prompting the user to accept an incoming friend invite. + /// "friendrequestignore" - Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite. + /// + public static void OpenUserOverlay( CSteamID id, string type ) => Internal.ActivateGameOverlayToUser( type, id ); + + /// + /// Activates the Steam Overlay to the Steam store page for the provided app. + /// + public static void OpenStoreOverlay( AppId id ) => Internal.ActivateGameOverlayToStore( id.Value, OverlayToStoreFlag.None ); + + /// + /// Activates Steam Overlay web browser directly to the specified URL. + /// + public static void OpenWebOverlay( string url, bool modal = false ) => Internal.ActivateGameOverlayToWebPage( url, modal ? ActivateGameOverlayToWebPageMode.Modal : ActivateGameOverlayToWebPageMode.Default ); + + /// + /// Activates the Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby. + /// + public static void OpenGameInviteOverlay( CSteamID lobby ) => Internal.ActivateGameOverlayInviteDialog( lobby ); + + /// + /// Mark a target user as 'played with'. + /// NOTE: The current user must be in game with the other player for the association to work. + /// + public static void SetPlayedWith( CSteamID steamid ) => Internal.SetPlayedWith( steamid ); } } \ No newline at end of file diff --git a/Facepunch.Steamworks/Redux/Structs/Friend.cs b/Facepunch.Steamworks/Redux/Structs/Friend.cs index 94fa561..874f000 100644 --- a/Facepunch.Steamworks/Redux/Structs/Friend.cs +++ b/Facepunch.Steamworks/Redux/Structs/Friend.cs @@ -54,6 +54,11 @@ public FriendGameInfo? GameInfo } } + public bool IsIn( CSteamID group_or_room ) + { + return Friends.Internal.IsUserInSource( Id, group_or_room ); + } + public struct FriendGameInfo { internal ulong GameID; // m_gameID class CGameID @@ -75,5 +80,6 @@ public static FriendGameInfo From( FriendGameInfo_t i ) } } + } } \ No newline at end of file