Skip to main content
Version: 6.0.0

GetGlobalLeaderboardViewByVersion

Method returns a view of global leaderboard results that centers on the current player. By using a non-current version id, the user can retrieve a historical leaderboard.

See GetGlobalLeaderboardVersions method to retrieve the version ID.

ServiceOperation
leaderboardGET_GLOBAL_LEADERBOARD_VIEW

Method Parameters​

ParameterDescription
leaderboardIdThe id of the leaderboard.
sortOrderSort order of page. ("HIGH_TO_LOW" or "LOW_TO_HIGH")
beforeCountThe count of number of players before the current player to include.
afterCountThe count of number of players after the current player to include.
versionIdThe historical version to retrieve.

Usage​

http://localhost:3000
string leaderboardId = "default";
SortOrder sortOrder = BrainCloudSocialLeaderboard.SortOrder.HIGH_TO_LOW;
int beforeCount = 3;
int afterCount = 4;
int versionId = -1;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.LeaderboardService.GetGlobalLeaderboardViewByVersion(leaderboardId, sortOrder, beforeCount, afterCount, versionId, successCallback, failureCallback);
JSON Response
{
"data": {
"leaderboardId": "abc",
"moreBefore": false,
"timeBeforeReset": 48085996,
"leaderboard": [
{
"playerId": "8c86f306-73ea-4536-9c92-aba086064d2c",
"score": 10,
"data": {
"nickname": "batman"
},
"createdAt": 1433863814394,
"updatedAt": 1433863814394,
"index": 0,
"rank": 1,
"name": "",
"summaryFriendData": {
"xp": 12,
"favColour": "red"
},
"pictureUrl": null
},
{
"playerId": "ab21c0af-9d3e-4a81-b3c8-ddc1fb77d9a1",
"score": 8,
"data": {
"nickname": "robin"
},
"createdAt": 1433864253221,
"updatedAt": 1433864253221,
"index": 1,
"rank": 2,
"name": "",
"summaryFriendData": null,
"pictureUrl": null
}
],
"server_time": 1433864314004,
"moreAfter": false
},
"status": 200
}