查询表
排行榜 表 信息查询。
URL确认
此API使用 service-api.playnanoo.com 域名。
API信息
- URL:
https://service-api.playnanoo.com/leaderboard/v20240301/table/show - Method:
PUT - 需要认证: 是
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| uid | string | 必填 | 表 代码 |
响应数据
| 字段 | 类型 | 说明 |
|---|---|---|
| Rotation | string | 循环 方式 |
| RotationCount | int | 当前 赛季 编号 |
| RotationTimeLeft | int | 赛季结束剩余时间 (秒) |
| RecordType | string | 记录 类型 |
| RecordSortType | string | 排序 类型 |
| TotalIds | double | 总记录数 |
代码示例
void UMyGame::ShowLeaderboardTable(const FString& TableCode)
{
// 요청 데이터 생성
// 플레이어 정보가 포함된 요청 바디 생성
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetStringField(TEXT("uid"), TableCode);
// JSON 문자열 변환
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);
// HTTP 요청
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/leaderboard/v20240301/table/show"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // 인증 토큰 포함
Request->SetContentAsString(JsonBody);
Request->OnProcessRequestComplete().BindLambda(
[](FHttpRequestPtr Req, FHttpResponsePtr Res, bool bSuccess)
{
if (bSuccess && Res.IsValid())
{
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Res->GetContentAsString());
if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
FString Rotation = JsonObject->GetStringField(TEXT("Rotation"));
int32 RotationCount = JsonObject->GetIntegerField(TEXT("RotationCount"));
int32 RotationTimeLeft = JsonObject->GetIntegerField(TEXT("RotationTimeLeft"));
FString RecordType = JsonObject->GetStringField(TEXT("RecordType"));
double TotalIds = JsonObject->GetNumberField(TEXT("TotalIds"));
UE_LOG(LogTemp, Log, TEXT("순환 방식: %s, 시즌: %d, 남은 시간: %d초"), *Rotation, RotationCount, RotationTimeLeft);
UE_LOG(LogTemp, Log, TEXT("기록 타입: %s, 총 참가자: %.0f"), *RecordType, TotalIds);
}
}
});
Request->ProcessRequest();
}
表 信息
通过此API可以确认排行榜的当前设置和状态。可以获取赛季是否即将结束、当前有多少玩家参与等信息。
赛季计时器
可以使用RotationTimeLeft在UI上显示赛季结束计时器。通过这个玩家可以知道赛季何时结束。