GetOtherPlayerLeaderboardPlace
public BackndPlayerLeaderboardReturnObject GetOtherPlayerLeaderboardPlace(string rankUuid, string playerInDate);
public BackndPlayerLeaderboardReturnObject GetOtherPlayerLeaderboardPlace(string rankUuid, string playerInDate, int gap);
Old version rankings cannot use this method.
BackndPlayerLeaderboardReturnObject
GetReturnValueByLeaderboardPlayerList
If an error occurred, null is returned.
BackndPlayerLeaderboardReturnObject bro = Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace("rankUuid", "otherInDate");
foreach(BackndPlayerLeaderboardItem item in bro.GetReturnValueByLeaderboardPlayerList()) {
Debug.Log(item.ToString());
}
BackndPlayerLeaderboardItem
public class BackndPlayerLeaderboardItem
{
public string gamerInDate;
public string nickname;
public string score;
public string index;
public string rank;
public string extraData = string.Empty;
public string extraName = string.Empty;
public string totalCount;
}
Parameters
Value | Type | Description | Default |
---|---|---|---|
rankUuid | string | uuid of the ranking to look up | - |
playerInDate | string | inDate of the user to look up | - |
gap | int | Number of rank holders above/below to be looked up together(0 - 100) | 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 users method
The playerInDate value can be checked using the following methods:
- Check the inDate of your friend
- Check the inDate of a guild member
- Check using the owner_inDate column of the public table
- Check by sharing the inDate of a user
Description
Looks up the user's rank in the ranking using a uuid value and playerInDate.
- If there is a tie between users(with the same rank), users with the same ranks may be returned when the gap method is used for the lookup.
Example
Synchronous
// Look up the rank of the user only
Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace("rankUuid", "playerInDate");
// Look up the ranking including three users above and below
// If the user is the 4th, the 1st - 7th users are looked up.
Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace("rankUuid", "playerInDate", 3);
Asynchronous
// Look up the rank of the user only
Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace("rankUuid", "playerInDate", callback => {
// Post-process
});
// Look up the ranking including three users above and below
// If the user is the 4th, the 1st - 7th users are looked up.
Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace("rankUuid", "playerInDate", 5, callback => {
// Post-process
});
Return cases
Success cases
When the user is in the ranking
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error cases
When the uuid is null or string.Empty
statusCode : 400
errorCode : ValidationException
When there is an attempt to look up with a playerInDate of a non-existent user
statusCode : 404
errorCode : NotFoundException
When there is an attempt to look up with a non-existent uuid
statusCode : 404
errorCode : NotFoundException
When the user does not exist in the ranking
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
When the gap is 0
{
"rows": [
{
// Gamer inDate of the user
"gamerInDate": {
"S": "2021-03-11T06:37:30.934Z"
},
// User's nickname
"nickname": {
"S": "Nickname No. 0"
},
// Additional field
// Name and value of the column are displayed.
// 'extraScore' if the column name of the additional field is 'extraScore'
"extraScore": {
"N": "0"
},
// Score
// Column names are unified as 'score'.
// It will be called 'score' even if the column name of the ranking field is 'power.'
"score": {
"N": "101"
},
// offset
"index": {
"N": 98
},
// User's rank
"rank": {
"N": 99
}
}
],
// Total number of rank holders registered in the ranking
"totalCount": 100
}
When the gap is 1
{
"rows": [
// User whose rank is 1 place higher than your rank
{
"gamerInDate": {
"S": "2021-03-11T06:37:32.616Z"
},
"nickname": {
"S": "Nickname No. 22"
},
"extraScore": {
"N": "2346"
},
"score": {
"N": "102"
},
"index": {
"N": 97
},
"rank": {
"N": 98
}
},
// Yourself
{
"gamerInDate": {
"S": "2021-03-11T06:37:30.934Z"
},
"nickname": {
"S": "Nickname No. 0"
},
"extraScore": {
"N": "0"
},
"score": {
"N": 101
},
"index": {
"N": 98
},
"rank": {
"N": 99
}
},
// User whose rank is 1 place lower than your rank
{
"gamerInDate": {
"S": "2021-03-11T06:37:31.838Z"
},
"nickname": {
"S": "Nickname No. 44"
},
"extraScore": {
"N": "2323"
},
"score": {
"N": "100"
},
"index": {
"N": 99
},
"rank": {
"N": 100
}
}
],
"totalCount": 100
}
Sample code
public class LeaderboardItem
{
public string gamerInDate;
public string nickname;
public string score;
public string index;
public string rank;
public string extraData = string.Empty;
public string extraName = string.Empty;
public string totalCount;
public override string ToString()
{
string str = $"UserinDate:{gamerInDate}\nNikckname:{nickname}\nScore:{score}\nSort:{index}\nPlacement:{rank}\nTotal:{totalCount}\n";
if(extraName != string.Empty)
{
str += $"{extraName}:{extraData}\n";
}
return str;
}
}
public void GetOtherPlayerLeaderboardPlaceTest()
{
string userUuid = "81272320-8c40-112b-b174-d9233f6bd0e8";
string playerInDate = "2022-03-02T01:51:32.967Z";
List<LeaderboardItem> rankItemList = new List<LeaderboardItem>();
BackndPlayerLeaderboardReturnObject bro = Backnd.Leaderboard.Player.GetOtherPlayerLeaderboardPlace(userUuid, playerInDate, 3);
if(bro.IsSuccess())
{
BACKND.LitJson.JsonData rankListJson = bro.GetFlattenJSON();
string extraName = string.Empty;
for(int i = 0; i < rankListJson["rows"].Count; i++)
{
LeaderboardItem rankItem = new LeaderboardItem();
rankItem.gamerInDate = rankListJson["rows"][i]["gamerInDate"].ToString();
rankItem.nickname = rankListJson["rows"][i]["nickname"].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();
if(rankListJson["rows"][i].ContainsKey(rankItem.extraName))
{
rankItem.extraData = rankListJson["rows"][i][rankItem.extraName].ToString();
}
rankItemList.Add(rankItem);
Debug.Log(rankItem.ToString());
}
}
}