Skip to content

Commit a015eb8

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Add GetLastActivePlatform() which returns the last used platform
1 parent 8ca9f4f commit a015eb8

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
@@ -4946,6 +4946,22 @@ public static void Ping(Action<LootLockerPingResponse> onComplete)
49464946
LootLockerAPIManager.Ping(onComplete);
49474947
}
49484948

4949+
/// <summary>
4950+
/// Get the Platform the user last used. This can be used to know what login method to prompt.
4951+
/// </summary>
4952+
/// <returns>The platform that was last used by the user</returns>
4953+
public static Platforms GetLastActivePlatform()
4954+
{
4955+
if (CurrentPlatform.Get() == Platforms.None)
4956+
{
4957+
return (Platforms)PlayerPrefs.GetInt("LastActivePlatform");
4958+
}
4959+
else
4960+
{
4961+
return CurrentPlatform.Get();
4962+
}
4963+
}
4964+
49494965

49504966
#endregion
49514967
}

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)