The Leaderboard plugin used to create, retrieve, or delete highscore entries.
More...
Inherits MonoBehaviour.
|
async Task | AddEntry (string playerName, int score, string levelName, byte[] metadata=null, int maxEntriesPerPlayer=5, bool sortAsc=false) |
| Used to add a highscore entry to the leaderboard. More...
|
|
async Task< List< ReceivedEntry > > | GetList (string levelName, string playerName=null, int startingIndex=0, int displayedEntries=10, bool allowDuplicateEntries=false, bool sortAsc=false) |
| Used to retrieve a list of highscore entries. More...
|
|
async Task< List< ReceivedEntry > > | GetListAdjacent (string levelName, string playerName, int playerScore, int adjacentEntries=2, bool allowDuplicateEntries=false, bool sortAsc=false) |
| Used to retrieve adjacent highscore entries. More...
|
|
async Task | DeleteByPlayerAndLevel (string levelName, string playerName) |
| Used to remove entries defined by the given level name and player name from the leaderboard. More...
|
|
async Task | DeleteByPlayer (string playerName) |
| Used to remove entries defined by the given player name from the leaderboard. More...
|
|
async Task | DeleteByLevel (string levelName) |
| Used to remove entries defined by the given level name from the leaderboard. More...
|
|
async Task | DeleteAll () |
| Used to remove all entries from the leaderboard. More...
|
|
|
const int | MAX_ENTRIES_TO_RETURN_AT_ONCE = 20 |
| The maximum number of entries that can be returned in one request
|
|
const int | MAX_METADATA_SIZE = 1024 * 10 |
| The maximum size of meta data that is allowed per entry
|
|
const int | MAX_STRING_LENGTH = 45 |
| The maximum length of username and level name string
|
|
const int | MAX_BYTES_PER_CHARACTER = 4 |
| All strings are utf-8 encoded so each character can at most take 4 bytes to encode
|
|
const int | MAX_STRING_BYTES = MAX_BYTES_PER_CHARACTER * MAX_STRING_LENGTH |
| The maximum byte length for the username and level name strings
|
|
const int | READ_BUFFER_SIZE = MAX_ENTRIES_TO_RETURN_AT_ONCE * (MAX_METADATA_SIZE + MAX_STRING_BYTES + MAX_STRING_BYTES + 4 * 5) |
| The size of a single read buffer. This is the maximum number of bytes a client can send in a single request. More...
|
|
The Leaderboard plugin used to create, retrieve, or delete highscore entries.
◆ AddEntry()
async Task Noble.Leaderboard.Leaderboard.AddEntry |
( |
string |
playerName, |
|
|
int |
score, |
|
|
string |
levelName, |
|
|
byte[] |
metadata = null , |
|
|
int |
maxEntriesPerPlayer = 5 , |
|
|
bool |
sortAsc = false |
|
) |
| |
|
inline |
Used to add a highscore entry to the leaderboard.
If a player has reached the maximum entry limit then the lowest score will automatically be deleted by default. If sorting by ascending the highest score will be deleted instead.
- Parameters
-
playerName | The name of the player associated with the entry to add. |
score | The score of the player associated with the entry to add. |
levelName | The name of the level associated with the entry to add. |
metadata | Any other relevant information associated with the entry to add. |
maxEntriesPerPlayer | The maximum amount of entries allowed per player. |
sortAsc | Determines sort order and rank order in the case that low scores are considered better. |
- Returns
- A task that you can await to know when the request has been completed.
- Exceptions
-
AccessViolationException | Thrown if the game ID is not valid. |
◆ DeleteAll()
async Task Noble.Leaderboard.Leaderboard.DeleteAll |
( |
| ) |
|
|
inline |
Used to remove all entries from the leaderboard.
- Returns
- A task that you can await to know when the request has been completed.
◆ DeleteByLevel()
async Task Noble.Leaderboard.Leaderboard.DeleteByLevel |
( |
string |
levelName | ) |
|
|
inline |
Used to remove entries defined by the given level name from the leaderboard.
- Parameters
-
levelName | The name of the level defining which entries to remove. |
- Returns
- A task that you can await to know when the request has been completed.
◆ DeleteByPlayer()
async Task Noble.Leaderboard.Leaderboard.DeleteByPlayer |
( |
string |
playerName | ) |
|
|
inline |
Used to remove entries defined by the given player name from the leaderboard.
- Parameters
-
playerName | The name of the player defining which entries to remove. |
- Returns
- A task that you can await to know when the request has been completed.
◆ DeleteByPlayerAndLevel()
async Task Noble.Leaderboard.Leaderboard.DeleteByPlayerAndLevel |
( |
string |
levelName, |
|
|
string |
playerName |
|
) |
| |
|
inline |
Used to remove entries defined by the given level name and player name from the leaderboard.
- Parameters
-
levelName | The name of the level defining which entries to remove. |
playerName | The name of the player defining which entries to remove. |
- Returns
- A task that you can await to know when the request has been completed.
◆ GetList()
async Task< List< ReceivedEntry > > Noble.Leaderboard.Leaderboard.GetList |
( |
string |
levelName, |
|
|
string |
playerName = null , |
|
|
int |
startingIndex = 0 , |
|
|
int |
displayedEntries = 10 , |
|
|
bool |
allowDuplicateEntries = false , |
|
|
bool |
sortAsc = false |
|
) |
| |
|
inline |
Used to retrieve a list of highscore entries.
- Parameters
-
levelName | The name of the level associated with the entries to return. |
playerName | The name of the player associated with the entries to return. |
startingIndex | The index of the first entry in the list to return. |
displayedEntries | The amount of entries in the list to return. |
allowDuplicateEntries | Whether or not to return multiple entries from a user in the list. |
sortAsc | Determines sort order and rank order in the case that low scores are considered better. |
- Returns
- The list of received entries.
- Exceptions
-
AccessViolationException | Thrown if the game ID is not valid. |
◆ GetListAdjacent()
async Task< List< ReceivedEntry > > Noble.Leaderboard.Leaderboard.GetListAdjacent |
( |
string |
levelName, |
|
|
string |
playerName, |
|
|
int |
playerScore, |
|
|
int |
adjacentEntries = 2 , |
|
|
bool |
allowDuplicateEntries = false , |
|
|
bool |
sortAsc = false |
|
) |
| |
|
inline |
Used to retrieve adjacent highscore entries.
Returns the scores adjacent to the entry defined by the level name, player name, and player score.
- Parameters
-
levelName | The name of the level defining which entries to return. |
playerName | The name of the player defining which entries to return. |
playerScore | The score of the player defining which entries to return. |
adjacentEntries | The amount of entries on either side of the defining entry to return. |
allowDuplicateEntries | Whether or not to return multiple entries from a user in the list. |
sortAsc | Determines sort order and rank order in the case that low scores are considered better. |
- Returns
- The list of received entries.
- Exceptions
-
AccessViolationException | Thrown if the game ID is not valid. |
◆ READ_BUFFER_SIZE
The size of a single read buffer. This is the maximum number of bytes a client can send in a single request.
45 comes from (player name length, level name length, score, client id, and message length) which are all 4 bytes each.
◆ HasActiveRequest
bool Noble.Leaderboard.Leaderboard.HasActiveRequest |
|
get |
Checks to see if you are currently waiting on a response from the server.
You may only have one active request at a time.