Methods
onHighScores(high_scores)
Gets called when high scores are returned after calling requestHighScores.
We highly recommend to read the High Score guide (developers.airconsole.com)
Parameters:
Name | Type | Description |
---|---|---|
high_scores |
Array.<AirConsole~HighScore> | The high scores. |
- Source:
onHighScoreStored(high_score)
Gets called when a high score was successfully stored.
We highly recommend to read the High Score guide (developers.airconsole.com)
Parameters:
Name | Type | Description |
---|---|---|
high_score |
AirConsole~HighScore | null | The stored high score if it is a new best for the user or else null. Ranks include "world", "country", "region", "city" if a high score is passed. |
- Source:
requestHighScores(level_name, level_version, uids, ranks, total, top)
Requests high score data of players (including global high scores and
friends). Will call onHighScores when data was received.
We highly recommend to read the High Score guide (developers.airconsole.com)
Parameters:
Name | Type | Description |
---|---|---|
level_name |
String | The name of the level |
level_version |
String | The version of the level |
uids |
Array.<String> | undefined | An array of UIDs of the users that should be included in the result. Default is all connected controllers |
ranks |
Array.<String> | undefined | An array of high score rank types.
High score rank types can include
data from across the world, only a
specific area or a users friends.
Valid array entries are "world",
"country", "region", "city",
"friends", "partner". Default is ["world"]. |
total |
number | undefined | Amount of high scores to return per rank type. Default is 8. |
top |
number | undefined | Amount of top high scores to return per rank type. top is part of total. Default is 5. |
- Source:
storeHighScore(level_name, level_version, score, uid, data, score_string)
Stores a high score of the current user on the AirConsole servers.
High Scores are public, not secure and anyone can request and tamper with
them. Do not store sensitive data. Only updates the high score if it was a
higher or same score. Calls onHighScoreStored when the request is done.
We highly recommend to read the High Score guide (developers.airconsole.com)
Parameters:
Name | Type | Description |
---|---|---|
level_name |
String | The name of the level the user was playing. This should be a human readable string because it appears in the high score sharing image. You can also just pass an empty string. |
level_version |
String | The version of the level the user was playing. This is for your internal use. |
score |
number | The score the user has achieved |
uid |
String | Array.<String> | undefined | The UIDs of the users that achieved the high score. Can be a single uid or an array of uids. Default is the uid of this device. |
data |
mixed | undefined | Custom high score data (e.g. can be used to implement Ghost modes or include data to verify that it is not a fake high score). |
score_string |
String | undefined | A short human readable representation of the score. (e.g. "4 points in 3s"). Defaults to "X points" where x is the score converted to an integer. |
- Source: