Moved Name, SteamId to SteamClient

This commit is contained in:
Garry Newman 2019-04-16 14:26:42 +01:00
parent 50ddedfd6e
commit 51b2b7dee2
5 changed files with 38 additions and 36 deletions

View File

@ -53,7 +53,7 @@ namespace Steamworks
// The client sends this data to the server along with their steamid
//
var ticketData = clientTicket.Data;
var clientSteamId = SteamUser.SteamId;
var clientSteamId = SteamClient.SteamId;
//
// Server listens to auth responses from Gabe

View File

@ -46,15 +46,15 @@ namespace Steamworks
[TestMethod]
public void IsLoggedOn()
{
Assert.AreNotEqual( false, SteamUser.IsLoggedOn );
Console.WriteLine( $"User.IsLoggedOn: {SteamUser.IsLoggedOn}" );
Assert.AreNotEqual( false, SteamClient.IsLoggedOn );
Console.WriteLine( $"User.IsLoggedOn: {SteamClient.IsLoggedOn}" );
}
[TestMethod]
public void SteamID()
{
Assert.AreNotEqual( 0, SteamUser.SteamId.Value );
Console.WriteLine( $"User.SteamID: {SteamUser.SteamId.Value}" );
Assert.AreNotEqual( 0, SteamClient.SteamId.Value );
Console.WriteLine( $"User.SteamID: {SteamClient.SteamId.Value}" );
}
[TestMethod]
@ -67,11 +67,11 @@ namespace Steamworks
Console.WriteLine( $"ticket.Handle: {ticket.Handle}" );
Console.WriteLine( $"ticket.Data: { string.Join( "", ticket.Data.Select( x => x.ToString( "x" ) ) ) }" );
var result = SteamUser.BeginAuthSession( ticket.Data, SteamUser.SteamId );
var result = SteamUser.BeginAuthSession( ticket.Data, SteamClient.SteamId );
Console.WriteLine( $"result: { result }" );
Assert.AreEqual( result, BeginAuthResult.OK );
SteamUser.EndAuthSession( SteamUser.SteamId );
SteamUser.EndAuthSession( SteamClient.SteamId );
}

View File

@ -75,5 +75,36 @@ namespace Steamworks
{
SteamApi.UnregisterCallback( intPtr );
}
/// <summary>
/// Checks if the current user's Steam client is connected 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. When the
/// connection is restored a SteamServersConnected_t callback will be posted.
/// You usually don't need to check for this yourself. All of the API calls that rely on this will
/// check internally. Forcefully disabling stuff when the player loses access is usually not a
/// very good experience for the player and you could be preventing them from accessing APIs that do not
/// need a live connection to Steam.
/// </summary>
public static bool IsLoggedOn => SteamUser.Internal.BLoggedOn();
/// <summary>
/// Gets the Steam ID of the account currently logged into the Steam client. This is
/// commonly called the 'current user', or 'local user'.
/// A Steam ID is a unique identifier for a Steam accounts, Steam groups, Lobbies and Chat
/// rooms, and used to differentiate users in all parts of the Steamworks API.
/// </summary>
public static SteamId SteamId => SteamUser.Internal.GetSteamID();
/// <summary>
/// returns the local players name - guaranteed to not be NULL.
/// this is the same name as on the users community profile page
/// </summary>
public static string Name => SteamFriends.Internal.GetPersonaName();
/// <summary>
/// gets the status of the current user
/// </summary>
public static FriendState State => SteamFriends.Internal.GetPersonaState();
}
}

View File

@ -104,17 +104,6 @@ namespace Steamworks
}
}
/// <summary>
/// returns the local players name - guaranteed to not be NULL.
/// this is the same name as on the users community profile page
/// </summary>
public static string Name => Internal.GetPersonaName();
/// <summary>
/// gets the status of the current user
/// </summary>
public static FriendState State => Internal.GetPersonaState();
public static IEnumerable<Friend> GetFriends()
{
for ( int i=0; i<Internal.GetFriendCount( (int) FriendFlags.Immediate ); i++ )

View File

@ -99,25 +99,7 @@ namespace Steamworks
/// </summary>
public static event Action<string> OnGameWebCallback;
/// <summary>
/// Checks if the current user's Steam client is connected 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. When the
/// connection is restored a SteamServersConnected_t callback will be posted.
/// You usually don't need to check for this yourself. All of the API calls that rely on this will
/// check internally. Forcefully disabling stuff when the player loses access is usually not a
/// very good experience for the player and you could be preventing them from accessing APIs that do not
/// need a live connection to Steam.
/// </summary>
public static bool IsLoggedOn => Internal.BLoggedOn();
/// <summary>
/// Gets the Steam ID of the account currently logged into the Steam client. This is
/// commonly called the 'current user', or 'local user'.
/// A Steam ID is a unique identifier for a Steam accounts, Steam groups, Lobbies and Chat
/// rooms, and used to differentiate users in all parts of the Steamworks API.
/// </summary>
public static SteamId SteamId => Internal.GetSteamID();
static bool _recordingVoice;