Skip to main content
Version: 5.11.4

GetRankListByScore

BackendReturnObject GetRankListByScore(string rankUuid, int score); BackendReturnObject GetRankListByScore(string rankUuid, long score);

Note

Old version rankings cannot use this method.

Parameters

ValueTypeDescription
rankUuidstringuuid of the ranking to look up
scoreint/longScore to look up

The rankUuid value can be checked using the following methods:

Description

Among the guilds registered in the ranking, looks up the guild with the score value and guilds above and below that score using a uuid value.

  • If there are multiple guilds with the looked-up score, all guilds will be looked up.
  • Even if there are multiple guilds above and below the score, only one guild above and below will be looked up.

Example

Synchronous

var score = 0; //Score to look up
Backend.URank.Guild.GetRankListByScore("rankUuid", score);

Asynchronous

var score = 0; //Score to look up
Backend.URank.Guild.GetRankListByScore("rankUuid", score, callback=> {
// Post-process
});

SendQueue

var score = 0; //Score to look up
SendQueue.Enqueue(Backend.URank.Guild.GetRankListByScore, "rankUuid", score, 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 guild of the ranking is not registered
statusCode : 200

returnValue : {"rows":[],"previousRank":{"NULL":true},"nextRank":{"NULL":true},"totalCount":0}

When the lookup is successful but there is no guild with that score
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 non-existent uuid
statusCode : 404
errorCode : NotFoundException

GetReturnValuetoJSON

When the guild with the score and guilds above and below that score all exist

{
"rows": [
{
// Guild name
"guildName": {
"S": "guilds0"
},
// Guild inDate
"guildInDate": {
"S": "2021-03-11T03:23:24.914Z"
},
// Score
// All 'score,' regardless of meta rankings and goods rankings.
"score": {
"N": "9999"
},
// offset
"index": {
"N": 1
},
// Guild rank
"rank": {
"N": 2
},
// and etc...
// Guilds with the same score are returned together.
}
],
// When the previousRank does not exist
"previousRank": {
"NULL": true
},
// When the previousRank exists
// Only 1 guild will be looked up.
"previousRank": [
{
"guildName": {
"S": "guilds1"
},
"guildInDate": {
"S": "2021-03-11T03:24:06.402Z"
},
"score": {
"N": 10000
},
"index": {
"N": 0
},
"rank": {
"N": 1
}
}
],
// When the nextRank does not exist
"nextRank": {
"NULL": true
},
// When the nextRank exists
// Only 1 guild will be looked up.
"nextRank": [
{
"guildName": {
"S": "guilds2"
},
"guildInDate": {
"S": "2021-03-11T03:24:05.378Z"
},
"score": {
"N": 5000
},
"index": {
"N": 2
},
"rank": {
"N": 3
}
}
],
// Total number of guilds registered in the ranking
"totalCount": 3
}

When there are no guilds with the score but there is a guild with a higher score

{
"rows": [ ],
// When the previousRank exists
// Only 1 guild will be looked up.
"previousRank": [
{
"guildName": {
"S": "guilds1"
},
"guildInDate": {
"S": "2021-03-11T03:24:06.402Z"
},
"score": {
"N": 10000
},
"index": {
"N": 0
},
"rank": {
"N": 1
}
}
],
// When the nextRank does not exist
"nextRank": {
"NULL": true
},
// Total number of guilds in the ranking
"totalCount": 907
}

Sample code

public class GuildRankItem
{
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 GetRankListByScoreTest()
{
SDKTester.InitializeFullTest();
int score = 1815817124;

List<GuildRankItem> rankItemList = new List<GuildRankItem>();

BackendReturnObject bro = Backend.URank.Guild.GetRankListByScore(guildRankUUID, score);

if(bro.IsSuccess())
{
LitJson.JsonData rankListJson = bro.GetFlattenJSON();

for(int i = 0; i < rankListJson["previousRank"].Count; i++)
{
GuildRankItem rankItem = new GuildRankItem();

rankItem.guildInDate = rankListJson["previousRank"][i]["guildInDate"].ToString();
rankItem.guildName = rankListJson["previousRank"][i]["guildName"].ToString();
rankItem.score = rankListJson["previousRank"][i]["score"].ToString();
rankItem.index = rankListJson["previousRank"][i]["index"].ToString();
rankItem.rank = rankListJson["previousRank"][i]["rank"].ToString();
rankItem.totalCount = rankListJson["totalCount"].ToString();

rankItemList.Add(rankItem);
Debug.Log(rankItem.ToString());
}

for(int i = 0; i < rankListJson["rows"].Count; i++)
{
GuildRankItem rankItem = new GuildRankItem();

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());
}
for(int i = 0; i < rankListJson["nextRank"].Count; i++)
{
GuildRankItem rankItem = new GuildRankItem();

rankItem.guildInDate = rankListJson["nextRank"][i]["guildInDate"].ToString();
rankItem.guildName = rankListJson["nextRank"][i]["guildName"].ToString();
rankItem.score = rankListJson["nextRank"][i]["score"].ToString();
rankItem.index = rankListJson["nextRank"][i]["index"].ToString();
rankItem.rank = rankListJson["nextRank"][i]["rank"].ToString();
rankItem.totalCount = rankListJson["totalCount"].ToString();

rankItemList.Add(rankItem);
Debug.Log(rankItem.ToString());
}
}
}