GetLeaderboard
public BackndGuildLeaderboardReturnObject GetLeaderboard(string rankUuid);
public BackndGuildLeaderboardReturnObject GetLeaderboard(string rankUuid, int limit);
public BackndGuildLeaderboardReturnObject GetLeaderboard(string rankUuid, int limit, int offset);
Old version rankings cannot use this method.
BackndGuildLeaderboardReturnObject
GetReturnValueByGuildLeaderboardList
If an error occurred, null is returned.
BackndGuildLeaderboardReturnObject bro = Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid");
foreach(BackndGuildLeaderboardItem item in bro.GetReturnValueByGuildLeaderboardList()) {
Debug.Log(item.ToString());
}
BackndGuildLeaderboardItem
public class BackndGuildLeaderboardItem
{
public string guildInDate;
public string guildName;
public string score;
public string index;
public string rank;
public string totalCount;
}
Parameters
Value | Type | Description | Default |
---|---|---|---|
rankUuid | string | uuid of the ranking to look up | - |
limit | int | Number of guilds to look up(1 - 100) | 10 |
offset | int | Starting point of the ranking to look up(0 or more) | 0 |
The rankUuid value can be checked using the following methods:
- Create a ranking in BACKND Console and check the uuid value from the information of the ranking
- Check the uuid value using the Look up ranking information of all guilds method
Description
Looks up list of guilds registered in the ranking using a uuid value.
Example
Synchronous
// Look up the 1st - 10th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid");
// Look up the 1st - 100th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid", 100);
// Look up the 11th - 20th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid", 10, 10);
Asynchronous
// Look up the 1st - 10th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid", callback=> {
// Post-process
});
// Look up the 1st - 100th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid", 100, callback=> {
// Post-process
});
// Look up the 11th - 20th guilds in the rankUuid ranking
Backnd.Leaderboard.Guild.GetLeaderboard("rankUuid", 10, 10, callback=> {
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
When the lookup is successful but the rank holder is not in the lookup range
statusCode : 200
returnValue : {"rows":[]}
Error cases
When the uuid is null or string.Empty
statusCode : 400
errorCode : ValidationException
When the uuid does not exist
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
GetReturnValuetoJSON
{
"rows": [
{
// Guild name
"guildName": {
"S": "guildName"
},
// Guild inDate
"guildInDate": {
"S": "2021-03-11T03:23:24.913Z"
},
// Guild score
// All 'score,' regardless of meta rankings and goods rankings.
"score": {
"N": "9999"
},
// offset
"index": {
"N": 0
},
// Guild rank
"rank": {
"N": 1
}
},
// and etc...
],
// Total number of guilds registered in the ranking
"totalCount": 100
}
Sample code
public class GuildLeaderboardItem
{
public string guildInDate;
public string guildName;
public string score;
public string index;
public string rank;
public string totalCount;
public override string ToString()
{
return $"guildInDate:{guildInDate}\nGuild name:{guildName}\nScore:{score}\nSort:{index}\nRank:{rank}\nTotal:{totalCount}\n";
}
}
public void GetLeaderboardTest()
{
int limit = 43;
List<GuildLeaderboardItem> rankItemList = new List<GuildLeaderboardItem>();
BackndGuildLeaderboardReturnObject bro = Backnd.Leaderboard.Guild.GetLeaderboard(userUuid, limit);
if(bro.IsSuccess())
{
BACKND.LitJson.JsonData rankListJson = bro.GetFlattenJSON();
for(int i = 0; i < rankListJson["rows"].Count; i++)
{
GuildLeaderboardItem rankItem = new GuildLeaderboardItem();
rankItem.guildInDate = rankListJson["rows"][i]["guildInDate"].ToString();
rankItem.guildName = rankListJson["rows"][i]["guildName"].ToString();
rankItem.score = rankListJson["rows"][i]["score"].ToString();
rankItem.index = rankListJson["rows"][i]["index"].ToString();
rankItem.rank = rankListJson["rows"][i]["rank"].ToString();
rankItem.totalCount = rankListJson["totalCount"].ToString();
rankItemList.Add(rankItem);
Debug.Log(rankItem.ToString());
}
}
}