Skip to content

Commit 6158e1b

Browse files
Erik Bylundkirre-bylund
authored andcommitted
Add a convenience method that verifies the player and then starts a steam session
1 parent 74f7193 commit 6158e1b

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ public static void VerifySteamID(string steamSessionTicket, Action<LootLockerVer
137137
/// <summary>
138138
/// Convert a steam ticket so LootLocker can read it. You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
139139
/// </summary>
140-
/// <param name="ticket"></param>
141-
/// <param name="ticketSize"></param>
142-
/// <returns>A converted SteamSessionTicket as a string for use with StartSteamSession.</returns>
140+
/// <param name="ticket">The Steam session ticket received from Steam Authentication</param>
141+
/// <param name="ticketSize">The size of the Steam session ticket received from Steam Authentication</param>
142+
/// <returns>A converted SteamSessionTicket as a string for use with VerifyPlayer.</returns>
143143
public static string SteamSessionTicket(ref byte[] ticket, uint ticketSize)
144144
{
145145
Array.Resize(ref ticket, (int)ticketSize);
@@ -326,6 +326,33 @@ public static void StartGuestSession(string identifier, Action<LootLockerGuestSe
326326
/// <summary>
327327
/// Start a steam session. You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
328328
/// </summary>
329+
/// <param name="steamId64">Steam ID as a string</param>
330+
/// <param name="ticket">The Steam session ticket received from Steam Authentication</param>
331+
/// <param name="ticketSize">The size of the Steam session ticket received from Steam Authentication</param>
332+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerSessionResponse</param>
333+
public static void VerifyPlayerAndStartSteamSession(string steamId64, ref byte[] ticket, uint ticketSize, Action<LootLockerSessionResponse> onComplete)
334+
{
335+
VerifySteamID(SteamSessionTicket(ref ticket, ticketSize), (LootLockerVerifyResponse verifyResponse) =>
336+
{
337+
if (!verifyResponse.success)
338+
{
339+
onComplete?.Invoke(new LootLockerSessionResponse
340+
{
341+
success = verifyResponse.success,
342+
statusCode = verifyResponse.statusCode,
343+
errorData = verifyResponse.errorData,
344+
text = verifyResponse.text
345+
});
346+
return;
347+
}
348+
StartSteamSession(steamId64, onComplete);
349+
});
350+
}
351+
352+
/// <summary>
353+
/// Start a steam session. You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
354+
/// Note: Steam requires that you verify the player using the VerifyPlayer method before starting a session
355+
/// </summary>
329356
/// <param name="steamId64">Steam ID ass a string</param>
330357
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerSessionResponse</param>
331358
public static void StartSteamSession(string steamId64, Action<LootLockerSessionResponse> onComplete)

0 commit comments

Comments
 (0)