Function usage
ArcadeLeaderboard.IsReady()
int IsReady(StatusCallback callback);
Name | Type | Description |
callback | StatusCallback | Callback function |
Returns:
int
. A value of
1
means the function has completed without error.
Initializes the Arcade Leaderboards API. The callback will provide a code when initialization completes, with either 0 for success or an error code . Call this function before calling other Leaderboard API functions.
DownloadLeaderboardScores()
int DownloadLeaderboardScores( StatusCallback callback, string pchLeaderboardName, LeaderBoardRequestType eLeaderboardDataRequest, LeaderBoardTimeRange eLeaderboardDataTimeRange, int nRangeStart, int nRangeEnd);
Name | Type | Description |
callback | StatusCallback | Callback function |
pchLeaderboardName | string | The API name of the leaderboard, as specified in the VIVEPORT Developer Console |
eLeaderboardDataRequest | LeaderBoardRequestType | Request type, see below |
eLeaderboardDataTimeRange | LeaderBoardTimeRange | Time range, see below |
nRangeStart | int | Range start, see below |
nRangeEnd | int | Range end, see below |
Returns:
int
. A value of
1
means the function has completed without error.
Call to download leaderboard score data from the VIVEPORT backend for the current end user. This data is cached by the SDK and can be retrieved with the GET functions.
If
eLeaderboardRequestType
is
GlobalData
or
LocalData
,
RangeStart
and
RangeEnd
refer to the absolute ranking of end users, starting from index
0
, with the exact order being determined by
LeaderBoardSortMethod
.
RangeStart
and
RangeEnd
must be whole numbers.
For example, if
RangeStart
and
RangeEnd
were set to
0
and
9
, the
leaderboard
scores for the first 10 positions will be downloaded. In this case, if the end-user is not in the top 10, their name will not be shown.
Index | Rank | Name | Score |
0 | 1 | player1 | 1000 |
1 | 2 | player2 | 900 |
2 | 3 | player3 | 800 |
3 | 4 | player4 | 700 |
4 | 5 | player5 | 600 |
5 | 6 | player6 | 500 |
6 | 7 | player7 | 400 |
7 | 8 | player8 | 300 |
8 | 9 | player9 | 200 |
9 | 10 | player10 | 100 |
The index is used when getting scores with
GetLeaderBoardScore()
.
If
LeaderboardRequestType
is
GlobalDataAroundUser
or
LocalDataAroundUser
,
RangeStart
and
RangeEnd
are the number of
leaderboard
scores ahead and behind the end user respectively. They must be whole numbers.
For example, if
RangeStart
and
RangeEnd
were set to
-3
and
3
, there would be 7 total scores downloaded, with the end user’s score in the middle:
Index | Rank | Name | Score |
0 | 6 | player1 | 1000 |
1 | 7 | player2 | 900 |
2 | 8 | player3 | 800 |
3 | 9 | user | 700 |
4 | 10 | player4 | 600 |
5 | 11 | player5 | 500 |
6 | 12 | player6 | 400 |
GetLeaderboardScore()
Leaderboard GetLeaderboardScore(int index);
Name | Type | Description |
index | int | Index position of the scoreboard |
Returns:
Leaderboard
. Returns the leaderboard score specified by index. The total number of leaderboard scores can be determined by
GetLeaderboardScoreCount()
.
Make sure that
DownloadLeaderBoardScore()
has completed successfully before calling this function.
GetLeaderboardScoreCount()
int GetLeaderboardScoreCount();
Returns:
int
. Returns the total number of scores starting from
0
.
Use the index value to call
GetLeaderBoardScore()
.
GetLeaderboardSortMethod()
LeaderBoardSortMethod GetLeaderboardSortMethod();
Returns:
LeaderBoardSortMethod
.
Gets the sorting method of the leaderboard so that the data can be displayed correctly.
GetLeaderboardDisplayType()
LeaderBoardDisplayType GetLeaderboardDisplayType();
Returns:
LeaderBoardDisplayType
.
Call this function to determine what kind of scores are stored, such as numeric, milliseconds, etc. For details on the return type, see
LeaderBoardDisplayType
.
UploadLeaderboardScore()
int UploadLeaderboardScore(StatusCallback callback, string pchLeaderboardName, int nScore);
Name | Type | Description |
callback | StatusCallback | Callback function |
pchLeaderboardName | string | The API name of the leaderboard, as specified in the VIVEPORT Developer Console |
nScore | int | Value of the score to be uploaded. Uploads for the current end user only. |
Returns:
int
. A value of
1
means the function has completed without error.
Uploads the end user’s score to the VIVEPORT backend. Note that only the current end user’s score can be changed.