GetGuildRank
public BackendReturnObject GetGuildRank(string rankUuid, string guildIndate);
public BackendReturnObject GetGuildRank(string rankUuid, string guildIndate, int gap);
Old version rankings cannot use this method.
Parameters
Value | Type | Description | Default |
---|---|---|---|
rankUuid | string | uuid of the ranking to look up | - |
guildIndate | string | inDate of the guild to look up | - |
gap | int | Number of guilds 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 guilds method
Description
Looks up the guild's rank in the ranking using a uuid value and guildIndate.
- If there is a tie between guilds(with the same rank), guilds with the same ranks may be returned when the gap method is used for the lookup.
Example
Synchronous
// Look up only the rank of the guild you joined.
Backend.URank.Guild.GetGuildRank("rankUuid", "guildIndate");
// Look up the ranking including three guilds above and below
// If your guild is the 4th, the 1st - 7th guilds are looked up.
Backend.URank.Guild.GetGuildRank("rankUuid", "guildIndate", 3);
Asynchronous
// Look up only the rank of the guild you joined.
Backend.URank.Guild.GetGuildRank("rankUuid", "guildIndate", callback => {
// Post-process
});
// Look up the ranking including three guilds above and below
// If your guild is the 4th, the 1st - 7th guilds are looked up.
Backend.URank.Guild.GetGuildRank("rankUuid", "guildIndate", 5, callback => {
// Post-process
});
SendQueue
// Look up only the rank of the guild you joined.
SendQueue.Enqueue(Backend.URank.Guild.GetGuildRank, "rankUuid", "guildIndate", callback => {
// Post-process
});
// Look up the ranking including three guilds above and below
// When there are 10 guilds in the ranking, and your guild is the 9th,
// the 6th - 10th guilds are looked up.
SendQueue.Enqueue(Backend.URank.Guild.GetGuildRank, "rankUuid", "guildIndate", 3, callback => {
// Post-process
});
Return cases
Success cases
When the ranking of the guild is looked up successfully
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error cases
When the uuid is null or string.Empty
statusCode : 400
errorCode : ValidationException
When the guildIndate 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
When there is an attempt to look up with a non-existent guildIndate
statusCode : 404
errorCode : NotFoundException
When the guild does not exist in the ranking
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
When the gap is 0
{
"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
}
}
],
// Total number of guilds registered in the ranking
"totalCount": 100
}
When the gap is 1
{
"rows": [
// Guild whose rank is 1 place lower than that of the looked-up guild
{
"guildName": {
"S": "guildName0"
},
"guildInDate": {
"S": "2021-03-11T03:23:24.913Z"
},
"score": {
"N": 10000
},
"index": {
"N": 0
},
"rank": {
"N": 1
}
},
// The looked-up guild
{
"guildName": {
"S": "guildName1"
},
"guildInDate": {
"S": "2021-03-11T03:23:24.912Z"
},
"score": {
"N": 9999
},
"index": {
"N": 1
},
"rank": {
"N": 2
}
},
// Guild whose rank is 1 place lower than that of the looked-up guild
{
"guildName": {
"S": "guildName2"
},
"guildInDate": {
"S": "2021-03-11T03:23:24.900Z"
},
"score": {
"N": 9998
},
"index": {
"N": 2
},
"rank": {
"N": 3
}
}
],
"totalCount": 100
}
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 GetGuildRankTest()
{
string guildUUID = "";
string guildIndate = "";
List<GuildRankItem> rankItemList = new List<GuildRankItem>();
BackendReturnObject bro = Backend.URank.Guild.GetGuildRank(guildUUID , guildIndate , 3);
if(bro.IsSuccess())
{
LitJson.JsonData rankListJson = bro.GetFlattenJSON();
string extraName = string.Empty;
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());
}
}
}