Skip to content

Commit aff4427

Browse files
committed
Add version of guest session with custom ID
1 parent 4c01bce commit aff4427

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,33 @@ public static void StartGuestSession(Action<LootLockerGuestSessionResponse> onCo
172172
});
173173
}
174174

175+
public static void StartGuestSession(string identifier, Action<LootLockerGuestSessionResponse> onComplete)
176+
{
177+
if (!CheckInitialized())
178+
{
179+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGuestSessionResponse>());
180+
return;
181+
}
182+
183+
if (identifier.Length == 0)
184+
{
185+
onComplete?.Invoke(LootLockerResponseFactory.Error<LootLockerGuestSessionResponse>("identifier cannot be empty"));
186+
return;
187+
}
188+
189+
LootLockerSessionRequest sessionRequest = new LootLockerSessionRequest(identifier);
190+
191+
LootLockerAPIManager.GuestSession(sessionRequest, response =>
192+
{
193+
CurrentPlatform = "guest";
194+
195+
PlayerPrefs.SetString("LootLockerGuestPlayerID", response.player_identifier);
196+
PlayerPrefs.Save();
197+
198+
onComplete(response);
199+
});
200+
}
201+
175202
public static void StartSteamSession(string steamId64, Action<LootLockerSessionResponse> onComplete)
176203
{
177204
if (!CheckInitialized())

0 commit comments

Comments
 (0)