Skip to content

Commit 2c7ec26

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Add override functions for GetInventory() with count and after parameters
1 parent 75973c5 commit 2c7ec26

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,32 @@ public static void GetOtherPlayerInfo(string playerIdentifier, string platform,
12771277
}
12781278

12791279

1280+
/// <summary>
1281+
/// Get the players inventory.
1282+
/// </summary>
1283+
/// <param name="count">Amount of assets to retrieve</param>
1284+
/// <param name="after">The instance ID the list should start from</param>
1285+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerInventoryResponse</param>
1286+
public static void GetInventory(int count, int after, Action<LootLockerInventoryResponse> onComplete)
1287+
{
1288+
if (!CheckInitialized())
1289+
{
1290+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerInventoryResponse>());
1291+
return;
1292+
}
1293+
1294+
var endpoint = LootLockerEndPoints.getInventory.endPoint;
1295+
1296+
endpoint += "?";
1297+
if (count > 0)
1298+
endpoint += $"count={count}&";
1299+
if (after > 0)
1300+
endpoint += $"after={after}&";
1301+
1302+
1303+
LootLockerServerRequest.CallAPI(endpoint, LootLockerHTTPMethod.GET, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
1304+
}
1305+
12801306
/// <summary>
12811307
/// Get the players inventory.
12821308
/// </summary>
@@ -1288,7 +1314,25 @@ public static void GetInventory(Action<LootLockerInventoryResponse> onComplete)
12881314
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerInventoryResponse>());
12891315
return;
12901316
}
1291-
LootLockerAPIManager.GetInventory(onComplete);
1317+
GetInventory(-1, -1, onComplete);
1318+
}
1319+
1320+
/// <summary>
1321+
/// Get the players inventory.
1322+
/// </summary>
1323+
/// <param name="count">Amount of assets to retrieve</param>
1324+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerInventoryResponse</param>
1325+
public static void GetInventory(int count, Action<LootLockerInventoryResponse> onComplete)
1326+
{
1327+
if (!CheckInitialized())
1328+
{
1329+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerInventoryResponse>());
1330+
return;
1331+
}
1332+
1333+
1334+
GetInventory(count, -1, onComplete);
1335+
12921336
}
12931337

12941338
/// <summary>

Runtime/Game/Requests/PlayerRequest.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,6 @@ public static void GetOtherPlayerInfo(LootLockerOtherPlayerInfoRequest data, Act
287287

288288
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
289289
}
290-
public static void GetInventory(Action<LootLockerInventoryResponse> onComplete)
291-
{
292-
var endPoint = LootLockerEndPoints.getInventory;
293-
294-
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, null, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
295-
}
296290

297291
public static void GetBalance(Action<LootLockerBalanceResponse> onComplete)
298292
{

0 commit comments

Comments
 (0)