GetOtherUserLeaderboardPlace
public BackendUserLeaderboardReturnObject GetOtherUserLeaderboardPlace(string leaderboardUuid, string userInDate);
public BackendUserLeaderboardReturnObject GetOtherUserLeaderboardPlace(string leaderboardUuid, string userInDate, int gap);
Parameters
Value | Type | Description | Default |
---|---|---|---|
leaderboardUuid | string | uuid of the leaderboard to look up | - |
userIndate | string | inDate of the user to look up | - |
gap | int | Number of rank holders above/below to be looked up together (0 - 25) | 0 |
The leaderboardUuid value can be checked using the following methods:
- Create a leaderboard in BACKND Console and check the uuid value from the information of the leaderboard
- Check the uuid value using the Look up leaderboard information of all users method
The userIndate 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 leaderboard using a uuid value and userIndate.
- 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.
- This method cannot be called via SendQueue.
BackendUserLeaderboardReturnObject
namespace BackEnd.Leaderboard
{
public class UserLeaderboardItem
{
public string gamerInDate;
public string nickname = string.Empty;
public string score;
public string index;
public string rank;
public string extraData = string.Empty;
public string extraName = string.Empty;
}
public class BackendUserLeaderboardReturnObject : BackendReturnObject
{
public long GetTotalCount();
public List<UserLeaderboardItem> GetUserLeaderboardList();
}
}
Example
Synchronous
BackEnd.Leaderboard.BackendUserLeaderboardReturnObject bro = null;
// Only look up the selected user's leaderboard
bro = Backend.Leaderboard.User.GetOtherUserLeaderboardPlace("leaderboardUuid", "userIndate");
// Look up the leaderboard including three users above and below
// If the user is the 4th, the 1st - 7th users are looked up
bro = Backend.Leaderboard.User.GetOtherUserLeaderboardPlace("leaderboardUuid", "userIndate", 3);
if(bro.IsSuccess() == false) {
return;
}
Debug.Log("Total number of users registered to the leaderboard : " + bro.GetTotalCount());
foreach(BackEnd.Leaderboard.UserLeaderboardItem item in bro.GetUserLeaderboardList())
{
Debug.Log($"Rank {item.rank} : {item.nickname}");
Debug.Log(item.ToString());
}
Asynchronous
// Only look up the selected user's leaderboard
Backend.Leaderboard.User.GetOtherUserLeaderboardPlace("leaderboardUuid", "userIndate", callback => {
if(bro.IsSuccess() == false) {
return;
}
Debug.Log("Total number of user registrations to leaderboard : " + callback.GetTotalCount());
foreach(BackEnd.Leaderboard.UserLeaderboardItem item in callback.GetUserLeaderboardList())
{
Debug.Log($"Rank {item.rank} : {item.nickname}");
Debug.Log(item.ToString());
}
});
// Look up the leaderboard including three users above and below
// If the user is the 4th, the 1st - 9th users are looked up
Backend.Leaderboard.User.GetOtherUserLeaderboardPlace("leaderboardUuid", "userIndate", 5, callback => {
// Post-process
});
ReturnCase
Success cases
When the user exists in the leaderboard
statusCode : 200
message : Success
returnValue : refer to GetReturnValuetoJSON
Error cases
When the uuid is null or string.Empty
statusCode : 400
errorCode : ValidationException
message : leaderboardUuid is null or empty
When there is an attempt to look up with a non-existent uuid
StatusCode : 404
ErrorCode : NotFoundException
Message : leaderboard not found, leaderboard cannot be found
When there is an attempt to look up with a userIndate of a non-existent user
statusCode : 404
errorCode : NotFoundException
message : gamer not found, gamer cannot be found
When the user does not exist in the leaderboard
statusCode : 404
errorCode : NotFoundException
message : userRank not found, userRank cannot be found
GetReturnValuetoJSON
When the gap is 0
{
"rows": [
{
"gamerInDate": "2024-05-08T07:17:20.455Z",
"nickname": "user4",
"rank": 5,
"index": 4,
"score": "5"
}
],
"totalCount": 10
}
When the gap is 1 (based on 2024-05-08T07:17:20.455Z)
{
"rows": [
{
"gamerInDate": "2024-05-08T07:17:20.928Z",
"nickname": "user5",
"rank": 4,
"index": 3,
"score": "6"
},
{
"gamerInDate": "2024-05-08T07:17:20.455Z",
"nickname": "user4",
"rank": 5,
"index": 4,
"score": "5"
},
{
"gamerInDate": "2024-05-08T07:17:19.951Z",
"nickname": "user3",
"rank": 6,
"index": 5,
"score": "4"
}
],
"totalCount": 10
}