Skip to content

모듈: leaderboard

플랫폼: 페이스북은 글로벌 리더보드를 지원하지 않습니다. 따라서 모든 리더보드 이름에 현재 컨텍스트ID를 추가해야 하며, 페이스북의 리더보드 API를 사용하려면 컨텍스트 내에서 실행해야 합니다.

목차

기능

기능

getConnectedPlayersEntriesAsync

getConnectedPlayersEntriesAsync(name, count, offset): Promise<LeaderboardEntry[]>

현재 플레이어와 그 플레이어와 연결된 플레이어들의 리더보드의 로컬 랭킹 목록을 순위순으로 가져옵니다.

Wortal.leaderboard.getConnectedPlayersEntriesAsync('global')
 .then(entries => console.log(entries));

매개변수

이름 유형 설명
name string 리더보드 이름.
count number 리더보드에서 검색하고자 하는 항목 수입니다. 지정하지 않으면 기본값은 "10"입니다. 현재 한 번의 쿼리로 최대 100개의 항목을 가져올 수 있습니다.
offset number 순서대로 연결된 플레이어의 점수 항목 세트에서 가져오는 오프셋을 가져옵니다.

Returns

Promise<LeaderboardEntry[]>

쿼리와 일치하는 리더보드 항목으로 해결되는 Promise.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM
  • NETWORK_FAILURE
  • RATE_LIMITED

getEntriesAsync

getEntriesAsync(name, count, offset?): Promise<LeaderboardEntry[]>

리더보드의 항목 목록을 고득점 순으로 가져옵니다.

Wortal.leaderboard.getEntriesAsync('global', 10)
 .then(entries => console.log(entries));

매개변수

이름 유형 설명
name string 리더보드 이름.
count number 리더보드에서 검색하고자 하는 항목 수입니다. 지정하지 않으면 기본값은 "10"입니다. 현재 한 번의 쿼리로 최대 100개의 항목을 가져올 수 있습니다.
offset? number 순서대로 연결된 플레이어의 점수 항목 세트에서 가져오는 오프셋을 가져옵니다.

Returns

Promise<LeaderboardEntry[]>

쿼리와 일치하는 리더보드 항목으로 해결되는 Promise.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM
  • NETWORK_FAILURE
  • RATE_LIMITED

getEntryCountAsync

getEntryCountAsync(name): Promise<number>

쿼리와 일치하는 리더보드 항목으로 쿼리를 해결합니다.

Wortal.leaderboard.getEntryCountAsync('global')
 .then(entries => console.log(entries));

매개변수

이름 유형 설명
name string 리더보드 이름.

Returns

Promise<number>

응모 수로 해결하는 Promise.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM
  • NETWORK_FAILURE
  • RATE_LIMITED

getLeaderboardAsync

getLeaderboardAsync(name): Promise<Leaderboard>

이 게임에 속한 특정 리더보드를 획득할 수 있습니다.

Wortal.leaderboard.getLeaderboardAsync('global')
 .then(leaderboard => console.log(leaderboard.name()));

매개변수

이름 유형 설명
name string 리더보드 이름. 게임의 각 리더보드에는 명확한 이름이 필요합니다.

Returns

Promise<Leaderboard>

일치하는 리더보드에서 해결하는 Promise . 찾을 수 없는 경우 거부됩니다.

Throws

  • NOT_SUPPORTED
  • LEADERBOARD_NOT_FOUND
  • NETWORK_FAILURE
  • CLIENT_UNSUPPORTED_OPERATION
  • INVALID_OPERATION
  • INVALID_PARAM

getPlayerEntryAsync

getPlayerEntryAsync(name): Promise<LeaderboardEntry>

현재 플레이어가 설정한 리더보드 항목을 가져옵니다. 설정되어 있지 않으면 Null을 반환합니다.

Wortal.leaderboard.getPlayerEntryAsync('global')
 .then(entry => console.log(entry.rank()));

매개변수

이름 유형 설명
name string 리더보드 이름.

Returns

Promise<LeaderboardEntry>

플레이어의 현재 순위표 항목으로 해결되는 Promise.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM
  • INVALID_OPERATION
  • NETWORK_FAILURE
  • RATE_LIMITED

sendEntryAsync

sendEntryAsync(name, score, details?): Promise<LeaderboardEntry>

플레이어의 점수를 업데이트합니다. 새로운 점수가 기존 점수보다 높은 경우에만 점수가 업데이트됩니다. 참고: 플레이어의 점수를 설정할 때 리더보드가 특정 컨텍스트와 연결되어 있는 경우, 해당 컨텍스트에 게임이 포함되어 있어야 합니다.

Wortal.leaderboard.sendEntryAsync('global', 100);

매개변수

이름 유형 유형
name string 리더보드 이름.
score number 항목의 점수, 64비트 정수 값이어야 합니다.
details? string 저장된 점수와 관련된 메타데이터 옵션. 크기는 2KB 이하이어야 합니다.

Returns

Promise<LeaderboardEntry>

업데이트 후 플레이어의 현재 순위표 항목으로 해결되는 약속.

Throws

  • NOT_SUPPORTED
  • LEADERBOARD_WRONG_CONTEXT
  • NETWORK_FAILURE
  • CLIENT_UNSUPPORTED_OPERATION
  • INVALID_PARAM
  • INVALID_OPERATION
  • RATE_LIMITED