Skip to content

Commit a45167e

Browse files
committed
feature: Expose multi user management methods
1 parent cea68b4 commit a45167e

File tree

1 file changed

+88
-1
lines changed

1 file changed

+88
-1
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,94 @@ public static void _OverrideLootLockerHTTPClientConfiguration(int maxRetries, in
120120
}
121121
#endif
122122

123-
#endregion
123+
124+
#endregion
125+
126+
#region Multi-User Management
127+
128+
/// <summary>
129+
/// Get a list of player ULIDs that have been active since game start (or state initialization).
130+
/// </summary>
131+
/// <returns>List of player ULIDs that have been active since game start.</returns>
132+
public static List<string> GetActivePlayerUlids()
133+
{
134+
return LootLockerStateData.GetActivePlayerULIDs();
135+
}
136+
137+
/// <summary>
138+
/// Make the state for the player with the specified ULID to be "inactive".
139+
///
140+
/// This will not delete the state, but it will remove it from the list of active players.
141+
/// </summary>
142+
/// <param name="playerUlid">The ULID of the player whose state should be set to inactive.</param>
143+
public static void SetPlayerUlidToInactive(string playerUlid)
144+
{
145+
LootLockerStateData.SetPlayerULIDToInactive(playerUlid);
146+
}
147+
148+
/// <summary>
149+
/// Get a list of player ULIDs that there is a stored state for.
150+
/// This includes both active and inactive players.
151+
/// </summary>
152+
/// <returns>List of player ULIDs that have a stored state.</returns>
153+
public static List<string> GetCachedPlayerUlids()
154+
{
155+
return LootLockerStateData.GetCachedPlayerULIDs();
156+
}
157+
158+
/// <summary>
159+
/// Get the ULID of the player state that is used as the default state for calls that have no other player specified.
160+
/// </summary>
161+
/// <returns>The ULID of the default player state.</returns>
162+
public static string GetDefaultPlayerUlid()
163+
{
164+
return LootLockerStateData.GetDefaultPlayerULID();
165+
}
166+
167+
/// <summary>
168+
/// Set the player state that is used as the default state for calls that have no other player specified.
169+
/// </summary>
170+
/// <param name="playerUlid">The ULID of the player state to set as default.</param>
171+
/// <returns>True if the default player ULID was set successfully, false otherwise.</returns>
172+
public static bool SetDefaultPlayerUlid(string playerUlid)
173+
{
174+
return LootLockerStateData.SetDefaultPlayerULID(playerUlid);
175+
}
176+
177+
/// <summary>
178+
/// Get the player state for the player with the specified ULID, or the default player state if the supplied player ULID is empty, or an empty state if none of the previous are present.
179+
/// </summary>
180+
/// <param name="playerUlid">The ULID of the player whose state should be retrieved.</param>
181+
/// <returns>The player state for the specified player, or the default player state if the supplied ULID is empty or could not be found, or an empty state if none of the previous are valid.</returns>
182+
public static LootLockerPlayerData GetSavedStateOrDefaultOrEmptyForPlayer(string playerUlid)
183+
{
184+
return LootLockerStateData.GetStateForPlayerOrDefaultStateOrEmpty(playerUlid);
185+
}
186+
187+
/// <summary>
188+
/// Remove stored state information for the specified player if present (player will need to re-authenticate).
189+
/// If the player is the default player, the default player will be set to an empty state.
190+
/// If the player is not the default player, the state will be removed but the default player will not be changed.
191+
/// If the player is not found, no action will be taken.
192+
/// </summary>
193+
/// <param name="playerUlid">The ULID of the player whose state should be cleared.</param>
194+
public static void ClearCacheForPlayer(string playerUlid)
195+
{
196+
LootLockerStateData.ClearSavedStateForPlayerWithULID(playerUlid);
197+
}
198+
199+
/// <summary>
200+
/// Remove all stored state information (players will need to re-authenticate).
201+
/// This will clear all player states, including the default player state.
202+
/// If you want to clear the state for a specific player, use ClearCacheForPlayer(string playerUlid) instead.
203+
/// This will also reset the default player to an empty state.
204+
/// </summary>
205+
public static void ClearAllPlayerCaches()
206+
{
207+
LootLockerStateData.ClearAllSavedStates();
208+
}
209+
210+
#endregion
124211

125212
#region Authentication
126213
/// <summary>

0 commit comments

Comments
 (0)