이전 시즌 기록 조회
특정 플레이어의 이전 시즌 리더보드 기록을 조회하는 API입니다.
URL 확인
이 API는 service-api.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-api.playnanoo.com/leaderboard/v20240301/show/prev - Method:
PUT - 인증 필요: 예
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| uid | string | 필수 | 테이블 코드 |
| record_id | string | 필수 | 기록 ID (플레이어 식별자) |
| rotation_count | int | 필수 | 시즌 번호 (조회할 이전 시즌) |
응답 데이터
Res 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| Rank | int | 플레이어의 순위 |
| RotationCount | int | 시즌 번호 |
| RecordId | string | 기록 ID |
| Score | int | 점수 |
| ExtraData | string | 추가 데이터 (JSON 문자열) |
Unity C# 구현
BaseResponse 클래스
모든 API 응답의 기본 클래스입니다.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
필드 설명:
ErrorCode: 에러 코드Message: 에러 메시지WithdrawalKey: 탈퇴 유예 상태인 경우 복구에 필요한 키 (탈퇴 유예 중인 계정만 제공)BlockKey: 차단된 계정인 경우 제공되는 키 (차단된 계정만 제공)
이전 시즌 기록 조회 클래스
using System;
using System.Collections;
using UnityEngine.Networking;
public class PlayerShowPrev
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/show/prev";
[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;
public int rotation_count;
public IEnumerator Send(string table_code, string recordId, int rotaionCount, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;
this.rotation_count = rotaionCount;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public int Rank;
public int RotationCount;
public string RecordId;
public int Score;
public string ExtraData;
}
}
사용 예제
public void ShowPreviousSeasonRecord()
{
PlayerShowPrev.Req req = new PlayerShowPrev.Req();
StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
rotaionCount: 1, // 이전 시즌 번호
onSuccess: res =>
{
Debug.Log("이전 시즌 기록 조회 성공");
Debug.Log($"순위: {res.Rank}");
Debug.Log($"점수: {res.Score}");
Debug.Log($"시즌: {res.RotationCount}");
// ExtraData가 있는 경우 파싱
if (!string.IsNullOrEmpty(res.ExtraData))
{
Debug.Log($"추가 데이터: {res.ExtraData}");
}
},
onError: error =>
{
Debug.LogError($"이전 시즌 기록 조회 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
이전 시즌 조회
rotation_count로 특정 이전 시즌을 지정할 수 있습니다. rotation_count=1은 바로 이전 시즌을 의미합니다.
시즌 기록
이전 시즌의 기록은 읽기 전용이며, 수정할 수 없습니다. 시즌이 종료된 후에는 해당 시즌의 데이터가 보관됩니다.