PICO Platform Unity SDK
|
Static Public Member Functions | |
static Task< LeaderboardList > | Get (string leaderboardName) |
Gets the information for a specified leaderboard. More... | |
static Task< LeaderboardEntryList > | GetEntries (string leaderboardName, int pageSize, int pageIdx, LeaderboardFilterType filter, LeaderboardStartAt startAt) |
Gets a list of entries. More... | |
static Task< LeaderboardEntryList > | GetEntriesAfterRank (string leaderboardName, int pageSize, int pageIdx, ulong afterRank) |
Gets a list of entries after a specified rank. More... | |
static Task< LeaderboardEntryList > | GetEntriesByIds (string leaderboardName, int pageSize, int pageIdx, LeaderboardStartAt startAt, string[] userIDs) |
Gets a list of entries for specified users. More... | |
static Task< bool > | WriteEntry (string leaderboardName, long score, byte[] extraData=null, bool forceUpdate=false) |
Writes an entry to a leaderboard. More... | |
static Task< bool > | WriteEntryWithSupplementaryMetric (string leaderboardName, long score, long supplementaryMetric, byte[] extraData=null, bool forceUpdate=false) |
Writes an entry to a leaderboard. The entry can include the supplementary metric for tiebreakers. More... | |
Leaderboard is one of the basic and important features of an app. By displaying users' rankings in a multi-dimensional approach, leaderboards can give rise to a competitive atmosphere among users in specific scenarios such as gaming, drive users to improve their skills, and therefore increase app engagement. You can also use leaderboards to promote the app and attract new users. Currently, Leaderboard service offers the following key features:
|
inlinestatic |
Gets the information for a specified leaderboard.
leaderboardName | The name of the leaderboard to get information for. |
Request information of type Task
, including the request ID, and its response message will contain data of type LeaderboardList
.
Error Code | Error Message |
---|---|
10701 | request server failed |
10703 | checking parameter failed |
10704 | leaderboard is not exist |
A message of type MessageType.Leaderboard_Get
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type LeaderboardList
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Gets a list of entries.
leaderboardName | The name of the leaderboard whose entries are to be returned. |
pageSize | The number of entries to return on each page. |
pageIdx | Defines which page of entries to return. The first page index is 0 . For example, if you want to get the first page of entries, pass 0 ; if you want to get the second page of entries, pass 1 . |
filter | Restricts the scope of entries to return:
|
startAt | Defines where to start returning leaderboard entries, the enumerations are:
|
Request information of type Task
, including the request ID, and its response message will contain data of type LeaderboardEntryList
.
Error Code | Error Message |
---|---|
3006501 | request server failed |
3006503 | checking parameter failed |
3006504 | leaderboard is not exist |
3006506 | load leaderboard data failed |
3006509 | get friend failed |
3006510 | get user account failed |
A message of type MessageType.Leaderboard_GetEntries
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type LeaderboardEntryList
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Gets a list of entries after a specified rank.
leaderboardName | The name of the leaderboard whose entries are to be returned. |
pageSize | The number of entries to return on each page. |
pageIdx | Defines which page of entries to return. The first page index is 0 . For example, if you want to get the first page of entries, pass 0 ; if you want to get the second page of entries, pass 1 . |
afterRank | Defines after which rank to return entries. |
Request information of type Task
, including the request ID, and its response message will contain data of type LeaderboardEntryList
.
Error Code | Error Message |
---|---|
10701 | request server failed |
10703 | checking parameter failed |
10704 | leaderboard is not exist |
10706 | load leaderboard data failed |
10709 | get friend failed |
10710 | get user account failed |
A message of type MessageType.Leaderboard_GetEntriesAfterRank
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type LeaderboardEntryList
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Gets a list of entries for specified users.
leaderboardName | The name of the leaderboard whose entries are to be returned. |
pageSize | The number of entries to return on each page. |
pageIdx | Defines which page of entries to return. The first page index is 0 . For example, if you want to get the first page of entries, pass 0 ; if you want to get the second page of entries, pass 1 . |
startAt | Defines where to start returning leaderboard entries, the enumerations are:
|
userIDs | The ID list of the users to get entries for. |
Request information of type Task
, including the request ID, and its response message will contain data of type LeaderboardEntryList
.
Error Code | Error Message |
---|---|
10701 | request server failed |
10703 | checking parameter failed |
10704 | leaderboard is not exist |
10706 | load leaderboard data failed |
10709 | get friend failed |
10710 | get user account failed |
A message of type MessageType.Leaderboard_GetEntriesByIds
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type LeaderboardEntryList
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Writes an entry to a leaderboard.
leaderboardName | The name of the leaderboard to write an entry to. |
score | The score to write. |
extraData | A 2KB custom data field that is associated with the leaderboard entry. This can be a game replay or anything that provides more details about the entry to the viewer. |
forceUpdate | Defines whether to force update the score. If set to true , the score always updates even if it is not the user's best score. |
Request information of type Task
, including the request ID, and its response message will contain data of type bool
.
Error Code | Error Message |
---|---|
10701 | request server failed |
10703 | checking parameter failed |
10704 | leaderboard is not exist |
10705 | no write permission |
10706 | load leaderboard data failed |
10707 | save leaderboard data failed |
10708 | extra data too long |
10714 | out of write time limit |
A message of type MessageType.Leaderboard_WriteEntry
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type bool
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Writes an entry to a leaderboard. The entry can include the supplementary metric for tiebreakers.
leaderboardName | The name of the leaderboard to write an entry to. |
score | The score to write. |
supplementaryMetric | The metric that can be used for tiebreakers. |
extraData | A 2KB custom data field that is associated with the leaderboard entry. This can be a game replay or anything that provides more details about the entry to the viewer. |
forceUpdate | Defines whether to force update the score. If set to true , the score always updates even if it is not the user's best score. |
Request information of type Task
, including the request ID, and its response message will contain data of type bool
.
Error Code | Error Message |
---|---|
10701 | request server failed |
10703 | checking parameter failed |
10704 | leaderboard is not exist |
10705 | no write permission |
10706 | load leaderboard data failed |
10707 | save leaderboard data failed |
10708 | extra data too long |
10714 | out of write time limit |
A message of type MessageType.Leaderboard_WriteEntryWithSupplementaryMetric
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type bool
. Extract the payload from the message handle with message.Data
.