GetLeaderboardReward
BackndPlayerLeaderboardRewardReturnObject GetLeaderboardReward(string rankUuid);
Old version rankings cannot use this method.
BackndPlayerLeaderboardRewardReturnObject
GetReturnValueByPlayerLeaderboardRewardList
If an error occurred, null is returned.
BackndPlayerLeaderboardReturnObject bro = Backnd.Leaderboard.Player.GetLeaderboardReward("rankUuid");
foreach(BackndPlayerLeaderboardRewardItem item in bro.GetReturnValueByPlayerLeaderboardRewardList()) {
Debug.Log(item.ToString());
}
BackndPlayerLeaderboardRewardItem
public class BackndPlayerLeaderboardRewardItem
{
public int startRank;
public int endRank;
public int rewardItemCount;
public string rewardChartName;
public Dictionary<string, string> rewardItems = new Dictionary<string, string>();
}
Parameter
Value | Type | Description |
---|---|---|
rankUuid | string | uuid of the ranking to look up |
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
Description
Looks up the reward information of the ranking using a uuid value.
This method is to look up the reward information of the ranking registered in the console, not to receive ranking rewards.
For more information on how to receive ranking rewards, please refer to the Look up mail and Receive mail documentation.
Example
Synchronous
Backnd.Leaderboard.Player.GetLeaderboardReward("rankUuid");
Asynchronous
Backnd.Leaderboard.Player.GetLeaderboardReward("rankUuid", callback => {
});
Return cases
Success cases
When the lookup is successful
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
When there is an attempt to look up with a uuid that has no reward
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
{
"rows": [
{
// Ranking reward item information
"rewardItems": {
// Item information
},
// First rank that will receive the ranking reward
"startRank": "1",
// Last rank that will receive the ranking reward
"endRank": "1",
// Number of items to be awarded
"rewardItemCount": "1",
// Name of the chart containing item information
"rewardDataTableName": "catTable"
},
// and etc...
]
}
Sample code
public class RankRewardItem
{
public int startRank;
public int endRank;
public int rewardItemCount;
public string rewardDataTableName;
public Dictionary<string, string> rewardItems = new Dictionary<string, string>();
public override string ToString()
{
string str = string.Empty;
foreach(var dic in rewardItems)
{
str += $"reward : {dic.Key} : {dic.Value}\n";
}
return $"startRank : {startRank}\n" +
$"endRank : {endRank}\n" +
$"rewardItemCount : {rewardItemCount}\n" +
$"rewardDataTableName : {rewardDataTableName}\n" + str;
}
}
public void GetLeaderboardReward()
{
BackndPlayerLeaderboardRewardReturnObject bro = Backnd.Leaderboard.Player.GetLeaderboardReward("9b41d1c0-8ef0-11ec-b651-c7dd98f693dc");
if(!bro.IsSuccess())
{
Debug.LogError(bro.ToString());
return;
}
List<RankRewardItem> rankRewardList = new List<RankRewardItem>();
BACKND.LitJson.JsonData rankRewardListJson = bro.FlattenRows();
for(int i = 0; i < rankRewardListJson.Count; i++)
{
RankRewardItem rankRewardItem = new RankRewardItem();
rankRewardItem.rewardItemCount = int.Parse(rankRewardListJson[i]["rewardItemCount"].ToString());
rankRewardItem.startRank = int.Parse(rankRewardListJson[i]["startRank"].ToString());
rankRewardItem.endRank = int.Parse(rankRewardListJson[i]["endRank"].ToString());
rankRewardItem.rewardDataTableName = rankRewardListJson[i]["rewardDataTableName"].ToString();
foreach(var column in rankRewardListJson[i]["rewardItems"].Keys)
{
rankRewardItem.rewardItems.Add(column, rankRewardListJson[i]["rewardItems"][column].ToString());
}
rankRewardList.Add(rankRewardItem);
Debug.Log(rankRewardItem.ToString());
}
}