Class Scores
Game Jolt supports multiple online score tables, or scoreboards, per game. You are able to, for example, have a score table for each level in your game, or a table for different scoring metrics. Gamers will keep coming back to try to achieve the highest scores for your game. With multiple formatting and sorting options, the system is quite flexible. You are also able to include extra data with each score. If there is other data associated with the score such as time played, coins collected, etc., you should definitely include it. It will be helpful in cases where you believe a gamer has illegitimately achieved a high score.
Inherited Members
Namespace: GameJolt.Services
Assembly: GameJolt.dll
Syntax
public sealed class Scores : Service
Methods
| Improve this Doc View SourceAdd(Credentials, Int32, String, String, Int32, Action<Response>)
Adds a score for a user or guest.
Declaration
public void Add(Credentials credentials, int value, string text, string extra = "", int tableId = 0, Action<Response> callback = null)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Int32 | value | This is a numerical sorting value associated with the score. All sorting will be based on this number. |
System.String | text | This is a string value associated with the score. This value will be shown to the user on GameJolt |
System.String | extra | If there's any extra data you would like to store as a string, you can use this variable. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
System.Action<Response> | callback | Action that is called on completion or error. |
Add(String, Int32, String, String, Int32, Action<Response>)
Adds a score for a user or guest. GameJolt let's you define if guest scores are allowed or not.
Declaration
public void Add(string guestName, int value, string text, string extra = "", int tableId = 0, Action<Response> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | guestName | The guest's name. |
System.Int32 | value | This is a numerical sorting value associated with the score. All sorting will be based on this number. |
System.String | text | This is a string value associated with the score. This value will be shown to the user on GameJolt |
System.String | extra | If there's any extra data you would like to store as a string, you can use this variable. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
System.Action<Response> | callback | Action that is called on completion or error. |
AddAsync(Credentials, Int32, String, String, Int32)
Adds a score for a user or guest.
Declaration
public Task<Response> AddAsync(Credentials credentials, int value, string text, string extra = "", int tableId = 0)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Int32 | value | This is a numerical sorting value associated with the score. All sorting will be based on this number. |
System.String | text | This is a string value associated with the score. This value will be shown to the user on GameJolt |
System.String | extra | If there's any extra data you would like to store as a string, you can use this variable. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |
AddAsync(String, Int32, String, String, Int32)
Adds a score for a user or guest. GameJolt let's you define if guest scores are allowed or not.
Declaration
public Task<Response> AddAsync(string guestName, int value, string text, string extra = "", int tableId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | guestName | The guest's name. |
System.Int32 | value | This is a numerical sorting value associated with the score. All sorting will be based on this number. |
System.String | text | This is a string value associated with the score. This value will be shown to the user on GameJolt |
System.String | extra | If there's any extra data you would like to store as a string, you can use this variable. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |
Fetch(Credentials, Int32, Int32, Nullable<Int32>, Nullable<Int32>, Action<Response<Score[]>>)
Returns a list of scores either for a user or globally for a game.
Declaration
public void Fetch(Credentials credentials = null, int tableId = 0, int limit = 10, int? betterThan = default(int? ), int? worseThan = default(int? ), Action<Response<Score[]>> callback = null)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | If provided, only the scores of this user are returned. |
System.Int32 | tableId | The id of the score table. If left empty, the primary table is used. |
System.Int32 | limit | The number of scores you'd like to return. The maximum amount of scores you can retrieve is 100. |
System.Nullable<System.Int32> | betterThan | If provided, only scores better than this value are returned. |
System.Nullable<System.Int32> | worseThan | If provided, only scores worse than this value are returned. |
System.Action<Response<Score[]>> | callback | Action that is called on completion or error. |
Fetch(String, Int32, Int32, Nullable<Int32>, Nullable<Int32>, Action<Response<Score[]>>)
Returns a list of scores either for a guest.
Declaration
public void Fetch(string guest, int tableId = 0, int limit = 10, int? betterThan = default(int? ), int? worseThan = default(int? ), Action<Response<Score[]>> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | guest | Only the scores of this guest are returned. |
System.Int32 | tableId | The id of the score table. If left empty, the primary table is used. |
System.Int32 | limit | The number of scores you'd like to return. The maximum amount of scores you can retrieve is 100. |
System.Nullable<System.Int32> | betterThan | If provided, only scores better than this value are returned. |
System.Nullable<System.Int32> | worseThan | If provided, only scores worse than this value are returned. |
System.Action<Response<Score[]>> | callback | Action that is called on completion or error. |
FetchAsync(Credentials, Int32, Int32, Nullable<Int32>, Nullable<Int32>)
Returns a list of scores either for a user or globally for a game.
The betterThan
and worseThan
parameters are mutually exclusive.
Declaration
public Task<Response<Score[]>> FetchAsync(Credentials credentials = null, int tableId = 0, int limit = 10, int? betterThan = default(int? ), int? worseThan = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | If provided, only the scores of this user are returned. |
System.Int32 | tableId | The id of the score table. If left empty, the primary table is used. |
System.Int32 | limit | The number of scores you'd like to return. The maximum amount of scores you can retrieve is 100. |
System.Nullable<System.Int32> | betterThan | If provided, only scores better than this value are returned. |
System.Nullable<System.Int32> | worseThan | If provided, only scores worse than this value are returned. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response<Score[]>> |
FetchAsync(String, Int32, Int32, Nullable<Int32>, Nullable<Int32>)
Returns a list of scores either for a user or globally for a game.
The betterThan
and worseThan
parameters are mutually exclusive.
Declaration
public Task<Response<Score[]>> FetchAsync(string guestName, int tableId = 0, int limit = 10, int? betterThan = default(int? ), int? worseThan = default(int? ))
Parameters
Type | Name | Description |
---|---|---|
System.String | guestName | Only the scores of this guest are returned. |
System.Int32 | tableId | The id of the score table. If left empty, the primary table is used. |
System.Int32 | limit | The number of scores you'd like to return. The maximum amount of scores you can retrieve is 100. |
System.Nullable<System.Int32> | betterThan | If provided, only scores better than this value are returned. |
System.Nullable<System.Int32> | worseThan | If provided, only scores worse than this value are returned. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response<Score[]>> |
FetchTables(Action<Response<Table[]>>)
Returns a list of high score tables for a game.
Declaration
public void FetchTables(Action<Response<Table[]>> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Response<Table[]>> | callback | Action that is called on completion or error. |
FetchTablesAsync()
Returns a list of high score tables for a game.
Declaration
public Task<Response<Table[]>> FetchTablesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response<Table[]>> |
GetRank(Int32, Int32, Action<Response<Int32>>)
Returns the rank of a particular score on a score table.
Declaration
public void GetRank(int value, int tableId = 0, Action<Response<int>> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | This is a numerical sorting value that is represented by a rank on the score table. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
System.Action<Response<System.Int32>> | callback | Action that is called on completion or error. |
GetRankAsync(Int32, Int32)
Returns the rank of a particular score on a score table.
Declaration
public Task<Response<int>> GetRankAsync(int value, int tableId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | This is a numerical sorting value that is represented by a rank on the score table. |
System.Int32 | tableId | The ID of the score table to submit to. If not set, the primary table is used. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response<System.Int32>> |