Class: LeaderboardEntry
Represent a leaderboard entry. An entry is created when a player submit score to the leaderboard for the first time. After creation, the entry will be only updated when a better score is submit by this player.
Methods
getExtraData
▸ getExtraData(): null
| string
Get the extra data submit with the last update. Returns null
if no
extra data exists.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getExtraData() // 'Hello world'
})
Returns
null
| string
Extra data appended with last update or creation
Defined in
models/leaderboard-entry.ts:110
getFormattedScore
▸ getFormattedScore(): string
Get the formatted score of this entry. Format is based on the leaderboard's setting.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getFormattedScore() // '100pt'
})
Returns
string
Formatted score
Defined in
models/leaderboard-entry.ts:62
getPlayer
▸ getPlayer(): LeaderboardPlayer
Get the player's info of this entry.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getPlayer().getID() // '5458282176661711'
})
Returns
Player's info
Defined in
models/leaderboard-entry.ts:125
getRank
▸ getRank(): number
Get the rank of this player. It's calculated based on the entry's score and the leaderboard's sort setting.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getRank() // 2
})
Returns
number
Rank
Defined in
models/leaderboard-entry.ts:94
getScore
▸ getScore(): number
Get the score of this entry.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getScore() // 100
})
Returns
number
Score
Defined in
models/leaderboard-entry.ts:46
getTimestamp
▸ getTimestamp(): number
Get the timestamp of when the entry is updated or created for the last time.
Example
leaderboard.setScoreAsync(100, 'Hello world')
.then((entry) => {
entry.getTimestamp() // 1527810893
})
Returns
number
Timestamp of last update or creation