查询玩家
查询排行榜中已记录的玩家信息。
调用信息
public void Show (string tableCode, string recordId, PlayNANOODelegate callback){}
// 查询往期玩家排名信息
public void ShowPrev (string uid, int rotationCount, string recordId, PlayNANOODelegate callback){}
调用详细信息
| 参数 | 说明 | 类型 |
|---|---|---|
| tableCode | 表代码 | string |
| recordId | 记录 ID(例如玩家 ID) | string |
| rotationCount | 更新轮次 | integer |
| callback | 通信结果 | PlayNANOODelegate |
源代码
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
string tableCode = "TableCode";
string recordId = "UserId";
plugin.LeaderboardManagerV20240301.Show(tableCode, recordId, (status, errorCode, jsonString, values) => {
if (status.Equals(Configure.PN_API_STATE_SUCCESS))
{
Debug.Log("Success");
Debug.Log(values["Rank"]);
Debug.Log(values["RotationCount"]);
Debug.Log(values["RecordId"]);
Debug.Log(values["Score"]);
Debug.Log(values["ExtraData"]);
}
else
{
Debug.Log("Fail");
}
});
// 查询往期玩家排名信息
int rotationCount = 1;
plugin.LeaderboardManagerV20240301.ShowPrev(tableCode, rotationCount, recordId, (status, errorCode, jsonString, values) => {
if (status.Equals(Configure.PN_API_STATE_SUCCESS))
{
Debug.Log("Success");
Debug.Log(values["Rank"]);
Debug.Log(values["RotationCount"]);
Debug.Log(values["RecordId"]);
Debug.Log(values["Score"]);
Debug.Log(values["ExtraData"]);
}
else
{
Debug.Log("Fail");
}
});
}
}
通信结果
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"Rank": 1,
"RotationCount": 1,
"RecordId": "string",
"Score": 100,
"ExtraData": "string"
}
通信结果详细信息
| 数据键 | 说明 | 类型 |
|---|---|---|
| Rank | 排名 | integer |
| RotationCount | 排行榜表轮次 | integer |
| RecordId | 记录 ID | string |
| Score | 分数 | integer |
| ExtraData | 附加数据 | string |