Data interface for a specific variant of a leaderboard; a variant is defined by the combination of the leaderboard's collection (public or friends) and time span (daily, weekly, or all-time).
Nested Class Summary
@interface | LeaderboardVariant.Collection | A leaderboard collection. | |
@interface | LeaderboardVariant.TimeSpan | A leaderboard time span. |
Constant Summary
int | COLLECTION_FRIENDS | Collection constant for friends leaderboards. |
int | COLLECTION_PUBLIC | Collection constant for public leaderboards. |
int | NUM_SCORES_UNKNOWN | Constant returned when the total number of scores for this variant is unknown. |
int | NUM_TIME_SPANS | Number of time spans that exist. |
int | PLAYER_RANK_UNKNOWN | Constant returned when a player's rank for this variant is unknown. |
int | PLAYER_SCORE_UNKNOWN | Constant returned when a player's score for this variant is unknown. |
int | TIME_SPAN_ALL_TIME | Scores are never reset. |
int | TIME_SPAN_DAILY | Scores are reset every day. |
int | TIME_SPAN_WEEKLY | Scores are reset once per week. |
Public Method Summary
abstract int |
getCollection()
Retrieves the collection of scores contained by this variant.
|
abstract String |
getDisplayPlayerRank()
Retrieves the viewing player's formatted rank for this variant, if any.
|
abstract String |
getDisplayPlayerScore()
Retrieves the viewing player's score for this variant, if any.
|
abstract long |
getNumScores()
Retrieves the total number of scores for this variant.
|
abstract long |
getPlayerRank()
Retrieves the viewing player's rank for this variant, if any.
|
abstract String |
getPlayerScoreTag()
Retrieves the viewing player's score tag for this variant, if any.
|
abstract long |
getRawPlayerScore()
Retrieves the viewing player's score for this variant, if any.
|
abstract int |
getTimeSpan()
Retrieves the time span that the scores for this variant are drawn from.
|
abstract boolean |
hasPlayerInfo()
Get whether or not this variant contains score information for the viewing
player or not.
|
Inherited Method Summary
Constants
public static final int COLLECTION_FRIENDS
Collection constant for friends leaderboards. These leaderboards contain the scores of players in the viewing player's friends list.
public static final int COLLECTION_PUBLIC
Collection constant for public leaderboards. Public leaderboards contain the scores of players who are sharing their gameplay activity publicly.
public static final int NUM_SCORES_UNKNOWN
Constant returned when the total number of scores for this variant is unknown.
public static final int NUM_TIME_SPANS
Number of time spans that exist. Needs to be updated if we ever have more.
public static final int PLAYER_RANK_UNKNOWN
Constant returned when a player's rank for this variant is unknown.
public static final int PLAYER_SCORE_UNKNOWN
Constant returned when a player's score for this variant is unknown.
public static final int TIME_SPAN_ALL_TIME
Scores are never reset.
public static final int TIME_SPAN_DAILY
Scores are reset every day. The reset occurs at 11:59PM PST.
public static final int TIME_SPAN_WEEKLY
Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday.
Public Methods
public abstract int getCollection ()
Retrieves the collection of scores contained by this variant. Possible values are
COLLECTION_PUBLIC
or
COLLECTION_FRIENDS
.
Returns
- The collection of scores contained by this variant.
public abstract String getDisplayPlayerRank ()
Retrieves the viewing player's formatted rank for this variant, if any. Note that
this value is only accurate if
hasPlayerInfo()
returns true
.
Returns
- The String representation of the viewing player's rank, or {@code null) if the player has no rank for this variant.
public abstract String getDisplayPlayerScore ()
Retrieves the viewing player's score for this variant, if any. Note that this value
is only accurate if
hasPlayerInfo()
returns true
.
Returns
- The String representation of the viewing player's score, or
null
if the player has no score for this variant.
public abstract long getNumScores ()
Retrieves the total number of scores for this variant. Not all of these scores will
always be present on the local device. Note that if scores for this variant have not
been loaded, this method will return
NUM_SCORES_UNKNOWN
.
Returns
- The number of scores for this variant, or
NUM_SCORES_UNKNOWN
.
public abstract long getPlayerRank ()
Retrieves the viewing player's rank for this variant, if any. Note that this value
is only accurate if
hasPlayerInfo()
returns true
.
Returns
- The long representation of the viewing player's rank, or
PLAYER_RANK_UNKNOWN
if the player has no rank for this variant.
public abstract String getPlayerScoreTag ()
Retrieves the viewing player's score tag for this variant, if any. Note that this
value is only accurate if
hasPlayerInfo()
returns true
.
Returns
- The score tag associated with the viewing player's score, or
null
if the player has no score for this variant.
public abstract long getRawPlayerScore ()
Retrieves the viewing player's score for this variant, if any. Note that this value
is only accurate if
hasPlayerInfo()
returns true
.
Returns
- The long representation of the viewing player's score, or
PLAYER_SCORE_UNKNOWN
if the player has no score for this variant.
public abstract int getTimeSpan ()
Retrieves the time span that the scores for this variant are drawn from. Possible
values are
TIME_SPAN_ALL_TIME
,
TIME_SPAN_WEEKLY
, or
TIME_SPAN_DAILY
.
Returns
- The time span that the scores for this variant are drawn from.
public abstract boolean hasPlayerInfo ()
Get whether or not this variant contains score information for the viewing player or
not. There are several possible reasons why this might be false
. If the
scores for this variant have never been loaded, we won't know if the player has a score
or not. Similarly, if the player has not submitted a score for this variant, this will
return false
.
It is possible to have a score but no rank. For instance, on leaderboard variants of
COLLECTION_PUBLIC
, players who are not sharing their scores publicly will
never have a rank.
Returns
- Whether or not this variant contains score information for the viewing player.