GetRankTableList
public BackendReturnObject GetRankTableList();
Note
Old version rankings cannot use this method.
Description
Returns all guild rankings generated in BACKND Console as a list.
The list contains the following information:
- Ranking name
- Ranking uuid
- Ranking cycle
- Whether to initialize data when initializing the ranking
- How to sort ranking
- Goods/metadata used in the ranking
Example
Synchronous
Backend.URank.Guild.GetRankTableList();
Asynchronous
Backend.URank.Guild.GetRankTableList(callback=>
{
// Post-process
});
SendQueue
SendQueue(Backend.URank.Guild.GetRankTableList, callback =>
{
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error cases
When the ranking does not exist
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
{
"rows": [
{
// Rank type. 'guild' in case of guild rankings
"rankType": {
"S": "guild"
},
// Exists only for one-time rankings.
// Start date of ranking
"rankStartDateAndTime": {
"S": "2021-03-14T15:00:00.000Z"
},
// Exists only for one-time rankings.
// End date of ranking
"rankEndDateAndTime": {
"S": "2021-03-15T05:00:00.000Z"
},
// Ranking period
// day : daily
// week : weekly
// month : monthly
// infinity : accumulative ranking
// custom : one-time ranking
"date": {
"S": "custom"
},
// Ranking uuid
"uuid": {
"S": "90c25d70-8535-11eb-b01b-af47a424fd51"
},
// How to sort ranking
// desc : descending order
// asc : ascending order
"order": {
"S": "desc"
},
// Whether to initialize the column used for the ranking upon initialization
"isReset": {
"BOOL": false
},
// Ranking name
"title": {
"S": "Guild ranking"
},
// Classification of goods/meta used in the ranking
// "goods" for goods rankings, and "meta" for meta rankings
"table":{
"S": "meta"
},
// Goods/metadata used in the ranking
// For goods rankings, totalGoods1Amount - totalGoods10Amount based on the type of goods used in the ranking
// For meta rankings, the key of meta used in the ranking
"column":
{
"S": "totalDamage"
}
},
// and etc...
]
}
Sample code
public class RankTableItem
{
public string rankType;
public string date;
public string uuid;
public string order;
public bool isReset;
public string title;
public string table;
public string column;
//Exists only for one-time rankings
public DateTime rankStartDateAndTime;
public DateTime rankEndDateAndTime;
//Exits only when there are additional fields
public string extraDataColumn;
public string extraDataType;
public override string ToString()
{
string str = $"rankType:{rankType}\n" +
$"date:{date}\n" +
$"uuid:{uuid}\n" +
$"order:{order}\n" +
$"isReset:{isReset}\n" +
$"title:{title}\n" +
$"table:{table}\n" +
$"column:{column}\n";
if(rankStartDateAndTime != DateTime.MinValue)
{
str += $"rankStartDateAndTime:{rankStartDateAndTime}\n" +
$"rankEndDateAndTime:{rankEndDateAndTime}\n";
}
if(extraDataColumn != null)
{
str += $"extraDataColumn:{extraDataColumn}\n" +
$"extraDataType:{extraDataType}\n";
}
return str;
}
}
public void GetRankTableListTest()
{
List<RankTableItem> rankTableItemList = new List<RankTableItem>();
BackendReturnObject bro = Backend.URank.User.GetRankTableList();
if(bro.IsSuccess())
{
LitJson.JsonData rankTableListJson = bro.FlattenRows();
for(int i = 0; i < rankTableListJson.Count; i++)
{
RankTableItem rankTableItem = new RankTableItem();
rankTableItem.rankType = rankTableListJson[i]["rankType"].ToString();
rankTableItem.date = rankTableListJson[i]["date"].ToString();
rankTableItem.uuid = rankTableListJson[i]["uuid"].ToString();
rankTableItem.order = rankTableListJson[i]["order"].ToString();
rankTableItem.isReset = rankTableListJson[i]["isReset"].ToString() == "true" ? true : false;
rankTableItem.title = rankTableListJson[i]["title"].ToString();
rankTableItem.table = rankTableListJson[i]["table"].ToString();
rankTableItem.column = rankTableListJson[i]["column"].ToString();
if(rankTableListJson[i].ContainsKey("rankStartDateAndTime"))
{
rankTableItem.rankStartDateAndTime = DateTime.Parse(rankTableListJson[i]["rankStartDateAndTime"].ToString());
rankTableItem.rankEndDateAndTime = DateTime.Parse(rankTableListJson[i]["rankEndDateAndTime"].ToString());
}
if(rankTableListJson[i].ContainsKey("extraDataColumn"))
{
rankTableItem.extraDataColumn = rankTableListJson[i]["extraDataColumn"].ToString();
rankTableItem.extraDataType = rankTableListJson[i]["extraDataType"].ToString();
}
rankTableItemList.Add(rankTableItem);
Debug.Log(rankTableItem.ToString());
}
}
}