Skip to content

Commit 686bd54

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Add GetLastActivePlatform() which returns the last used platform
1 parent 5424b07 commit 686bd54

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4607,6 +4607,22 @@ public static void Ping(Action<LootLockerPingResponse> onComplete)
46074607
LootLockerAPIManager.Ping(onComplete);
46084608
}
46094609

4610+
/// <summary>
4611+
/// Get the Platform the user last used. This can be used to know what login method to prompt.
4612+
/// </summary>
4613+
/// <returns>The platform that was last used by the user</returns>
4614+
public static Platforms GetLastActivePlatform()
4615+
{
4616+
if (CurrentPlatform.Get() == Platforms.None)
4617+
{
4618+
return (Platforms)PlayerPrefs.GetInt("LastActivePlatform");
4619+
}
4620+
else
4621+
{
4622+
return CurrentPlatform.Get();
4623+
}
4624+
}
4625+
46104626

46114627
#endregion
46124628
}

Runtime/Game/Platforms/PlatformManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public static string GetFriendlyString()
105105

106106
public static void Set(Platforms platform)
107107
{
108+
PlayerPrefs.SetInt("LastActivePlatform", (int)platform);
108109
current = GetPlatformRepresentation(platform);
109110
}
110111

0 commit comments

Comments
 (0)