This commit is contained in:
Garry Newman 2019-04-15 15:54:10 +01:00
parent 088e9918e0
commit ca20e5a75a
4 changed files with 50 additions and 48 deletions

View File

@ -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;

View File

@ -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<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 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 ); }
}
}

View File

@ -67,7 +67,51 @@ public static IEnumerable<Friend> GetPlayedWith()
}
}
/// <summary>
/// The dialog to open. Valid options are:
/// "friends",
/// "community",
/// "players",
/// "settings",
/// "officialgamegroup",
/// "stats",
/// "achievements".
/// </summary>
public static void OpenOverlay( string type ) => Internal.ActivateGameOverlay( type );
/// <summary>
/// "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.
/// </summary>
public static void OpenUserOverlay( CSteamID id, string type ) => Internal.ActivateGameOverlayToUser( type, id );
/// <summary>
/// Activates the Steam Overlay to the Steam store page for the provided app.
/// </summary>
public static void OpenStoreOverlay( AppId id ) => Internal.ActivateGameOverlayToStore( id.Value, OverlayToStoreFlag.None );
/// <summary>
/// Activates Steam Overlay web browser directly to the specified URL.
/// </summary>
public static void OpenWebOverlay( string url, bool modal = false ) => Internal.ActivateGameOverlayToWebPage( url, modal ? ActivateGameOverlayToWebPageMode.Modal : ActivateGameOverlayToWebPageMode.Default );
/// <summary>
/// Activates the Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby.
/// </summary>
public static void OpenGameInviteOverlay( CSteamID lobby ) => Internal.ActivateGameOverlayInviteDialog( lobby );
/// <summary>
/// Mark a target user as 'played with'.
/// NOTE: The current user must be in game with the other player for the association to work.
/// </summary>
public static void SetPlayedWith( CSteamID steamid ) => Internal.SetPlayedWith( steamid );
}
}

View File

@ -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 )
}
}
}
}