(a00338777) v0.9.2.1
This commit is contained in:
@@ -14,17 +14,60 @@ namespace Facepunch.Steamworks
|
||||
get
|
||||
{
|
||||
if ( _auth == null )
|
||||
_auth = new Auth{ client = this };
|
||||
_auth = new Auth(this);
|
||||
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Steam authentication statuses
|
||||
/// </summary>
|
||||
public enum ClientAuthStatus : int
|
||||
{
|
||||
OK = 0,
|
||||
UserNotConnectedToSteam = 1,
|
||||
NoLicenseOrExpired = 2,
|
||||
VACBanned = 3,
|
||||
LoggedInElseWhere = 4,
|
||||
VACCheckTimedOut = 5,
|
||||
AuthTicketCanceled = 6,
|
||||
AuthTicketInvalidAlreadyUsed = 7,
|
||||
AuthTicketInvalid = 8,
|
||||
PublisherIssuedBan = 9,
|
||||
}
|
||||
|
||||
public enum ClientStartAuthSessionResult : int
|
||||
{
|
||||
OK = 0,
|
||||
InvalidTicket = 1,
|
||||
DuplicateRequest = 2,
|
||||
InvalidVersion = 3,
|
||||
GameMismatch = 4,
|
||||
ExpiredTicket = 5,
|
||||
ServerNotConnectedToSteam = 6,
|
||||
}
|
||||
|
||||
public class Auth
|
||||
{
|
||||
public Auth(Client c)
|
||||
{
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<SteamNative.ValidateAuthTicketResponse_t>(OnAuthTicketValidate);
|
||||
}
|
||||
|
||||
void OnAuthTicketValidate(SteamNative.ValidateAuthTicketResponse_t data)
|
||||
{
|
||||
if (OnAuthChange != null)
|
||||
OnAuthChange(data.SteamID, data.OwnerSteamID, (ClientAuthStatus)data.AuthSessionResponse);
|
||||
}
|
||||
|
||||
internal Client client;
|
||||
|
||||
public Action<ulong, ulong, ClientAuthStatus> OnAuthChange;
|
||||
|
||||
public class Ticket : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
@@ -77,6 +120,27 @@ namespace Facepunch.Steamworks
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start authorizing a ticket. This user isn't authorized yet. Wait for a call to OnAuthChange.
|
||||
/// </summary>
|
||||
public unsafe ClientStartAuthSessionResult StartSession(byte[] data, ulong steamid)
|
||||
{
|
||||
fixed (byte* p = data)
|
||||
{
|
||||
var result = client.native.user.BeginAuthSession((IntPtr)p, data.Length, steamid);
|
||||
|
||||
return (ClientStartAuthSessionResult)result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forget this guy. They're no longer in the game.
|
||||
/// </summary>
|
||||
public void EndSession(ulong steamid)
|
||||
{
|
||||
client.native.user.EndAuthSession(steamid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user