Steam
|
SteamLeaderboardsMain is the easy to use lightweight Steam Leaderboards API of the Easy Steamworks Integration Unity plugin. Use this class to download sorted leaderboards, submit highscores, handle additional score entry data and load avatar textures. More...
Inherits LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain >.
Public Member Functions | |
bool | UploadScore (string p_leaderboardName, int p_score, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. If the leaderboard with the given name does not yet exist, then it will be created with the display type given in SteamLeaderboardsMain.ScoreType. If the leaderboard with the given name does not yet exist, then it will be created with the sorting given in SteamLeaderboardsMain.ScoreSortMethod. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | UploadScore (string p_leaderboardName, int p_score, ELeaderboardSortMethod p_scoreSorting, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. If the leaderboard with the given name does not yet exist, then it will be created with the display type given in SteamLeaderboardsMain.ScoreType. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | UploadScore (string p_leaderboardName, int p_score, ELeaderboardDisplayType p_scoreType, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. If the leaderboard with the given name does not yet exist, then it will be created with the sorting given in SteamLeaderboardsMain.ScoreSortMethod. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | UploadScore (string p_leaderboardName, int p_score, ELeaderboardSortMethod p_scoreSorting, ELeaderboardDisplayType p_scoreType, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | UploadScore (string p_leaderboardName, int p_score, ELeaderboardSortMethod p_scoreSorting, ELeaderboardDisplayType p_scoreType, string p_scoreDetails, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | UploadScore (string p_leaderboardName, int p_score, ELeaderboardSortMethod p_scoreSorting, ELeaderboardDisplayType p_scoreType, int[] p_scoreDetails, System.Action< LeaderboardsUploadedScoreEventArgs > p_onUploadedScore) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done. See also SteamLeaderboardsMain.OnUploadedScore. More... | |
bool | DownloadScores (string p_leaderboardName, System.Action< LeaderboardsDownloadedScoresEventArgs > p_onDownloadedScores) |
Downloads the leaderboard with the given name. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores. SteamLeaderboardsMain.ScoreDownloadSource, SteamLeaderboardsMain.ScoreDownloadRangeStart and SteamLeaderboardsMain.ScoreDownloadRangeEnd will be used as filter critera. More... | |
bool | DownloadScoresAroundUser (string p_leaderboardName, int p_range, System.Action< LeaderboardsDownloadedScoresEventArgs > p_onDownloadedScores) |
Downloads the leaderboard entries around the current user's score record. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores. More... | |
bool | DownloadScores (string p_leaderboardName, ELeaderboardDataRequest p_scoreSource, int p_rangeStart, int p_rangeEnd, System.Action< LeaderboardsDownloadedScoresEventArgs > p_onDownloadedScores) |
Downloads the leaderboard for the filter criteria. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores. More... | |
bool | IsAvatarTextureSet (LeaderboardsScoreEntry p_scoreEntry) |
Most users who didn't set their avatar have a question mark as their avatar texture. However, Steam allows to check if there is no texture set at all, which will probably never happen. More... | |
bool | IsAvatarTextureSet (CSteamID p_steamIDUser) |
Most users who didn't set their avatar have a question mark as their avatar texture. However, Steam allows to check if there is no texture set at all, which will probably never happen. More... | |
Texture2D | GetAvatarTexture (LeaderboardsScoreEntry p_scoreEntry) |
If Steam has already downloaded the user's avatar, then it will be returned as Texture2D. Otherwise, will return null if the user has no avatar image at all or the image is still loading. Will start the download of the user's avatar if Steam is not yet loading it. More... | |
Texture2D | GetAvatarTexture (CSteamID p_steamIDUser) |
If Steam has already downloaded the user's avatar, then it will be returned as Texture2D. Otherwise, will return null if the user has no avatar image at all or the image is still loading. Will start the download of the user's avatar if Steam is not yet loading it. More... | |
string | FormatScore (int p_score, ELeaderboardDisplayType p_scoreType) |
Formats p_score with SteamLeaderboardsMain.ScoreFormatNumeric or SteamLeaderboardsMain.ScoreFormatSeconds or SteamLeaderboardsMain.ScoreFormatMilliSeconds taking p_scoreType into account. More... | |
Public Member Functions inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
void | Execute< T > (SteamAPICall_t p_steamCall, CallResult< T >.APIDispatchDelegate p_onCompleted) |
The Execute method will handle Steam CallResult creation and storage. Simply pass the configured SteamAPICall and the callback that you want to be invoked when the work is done. Pending results can be viewed in the console with SteamMainBase.IsDebugLogEnabled set to true . More... | |
Static Public Member Functions | |
static string | ConvertIntArrayToStr (int[] p_array) |
Converts an integer array to a string. Can be used to parse additional score details. More... | |
static int [] | ConvertStrToIntArray (string p_str) |
Converts an integer array to a string. Can be used to upload additional score details. More... | |
Protected Member Functions | |
override void | LateUpdate () |
Protected Member Functions inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
virtual void | OnDisable () |
virtual bool | CheckAndLogResultNoEvent< Trequest > (string p_logText, EResult p_result, bool p_bIOFailure) |
virtual bool | CheckAndLogResult< Trequest, Tevent > (string p_logText, EResult p_result, bool p_bIOFailure, string p_eventName, ref System.Action< Tevent > p_event) |
virtual void | HandleError (string p_logPrefix, ErrorEventArgs p_error) |
virtual void | InvokeEventHandlerSafely< T > (System.Action< T > p_handler, T p_data) |
virtual void | SetSingleShotEventHandler< T > (string p_eventName, ref System.Action< T > p_event, System.Action< T > p_handler) |
virtual void | CallSingleShotEventHandlers< T > (string p_eventName, T p_args, ref System.Action< T > p_event) |
virtual void | ClearSingleShotEventHandlers< T > (string p_eventName, ref System.Action< T > p_event) |
Properties | |
ELeaderboardSortMethod | ScoreSortMethod [get, set] |
If you use SteamLeaderboardsMain.UploadScore to create leaderboards, then set the correct sorting mode here. Alternatively, you can also pass the desired sorting mode to the SteamLeaderboardsMain.UploadScore method. More... | |
ELeaderboardDisplayType | ScoreType [get, set] |
If you use SteamLeaderboardsMain.UploadScore to create leaderboards, then set the correct display type here. Alternatively, you can also pass the desired display type to the SteamLeaderboardsMain.UploadScore method. More... | |
ELeaderboardDataRequest | ScoreDownloadSource [get, set] |
Define the leaderboard source here. Global: global highscores. AroundUser: scores around user's score (adapt range!). Friends: scores for friends only. More... | |
int | ScoreDownloadRangeStart [get, set] |
Score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser. More... | |
int | ScoreDownloadRangeEnd [get, set] |
Score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser. More... | |
ELeaderboardUploadScoreMethod | ScoreUploadMethod [get, set] |
Select when the users score should be updated here. KeepBest: overwrite existing scores only with new records. ForceUpdate: always overwrite existing scores. More... | |
int | ScoreDownloadDetailsLength [get, set] |
Determines the maximal integers count of additional score entry data downloaded from Steam. Could be used to load replays. More... | |
string | ScoreFormatNumeric [get, set] |
The pattern used to format scores of Numeric type. More... | |
string | ScoreFormatSeconds [get, set] |
The pattern used to format scores of Seconds type. More... | |
string | ScoreFormatMilliSeconds [get, set] |
The pattern used to format scores of MilliSeconds type. More... | |
Properties inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
static SteamMainT | Instance [get] |
You can use the static Instance property to access the Steam API from wherever you need it in your code. See also SteamMainBase.IsInstanceSet. More... | |
static bool | IsInstanceSet [get] |
The static IsInstanceSet property can be used before accessing the Instance property to prevent a new instance from being created in the teardown phase. For example, if you want to unregister from an event, then first check that IsInstanceSet is true. If it is false, then your event registration is not valid anymore. More... | |
bool | IsDebugLogEnabled [get, set] |
Set this property to true if you want to see a detailed log in the console. Disabled by default. More... | |
Events | |
System.Action< LeaderboardsUploadedScoreEventArgs > | OnUploadedScore |
Invoked when a score entry was successfully uploaded or updated. See also SteamLeaderboardsMain.UploadScore. More... | |
System.Action< LeaderboardsDownloadedScoresEventArgs > | OnDownloadedScores |
Invoked when the leaderboard score entries are fully loaded. See also SteamLeaderboardsMain.DownloadScores. More... | |
Events inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
System.Action< ErrorEventArgs > | OnError |
Invoked when a Steam error has occured. More... | |
Additional Inherited Members | |
Protected Attributes inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
SteamRequestList | m_pendingRequests |
object | m_lock |
bool | m_isDebugLogEnabled |
Static Protected Attributes inherited from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain > | |
static SteamMainT | s_instance |
SteamLeaderboardsMain is the easy to use lightweight Steam Leaderboards API of the Easy Steamworks Integration Unity plugin. Use this class to download sorted leaderboards, submit highscores, handle additional score entry data and load avatar textures.
|
static |
Converts an integer array to a string. Can be used to parse additional score details.
p_array | integer array to parse. |
|
static |
Converts an integer array to a string. Can be used to upload additional score details.
p_str | string to encode. |
bool LapinerTools.Steam.SteamLeaderboardsMain.DownloadScores | ( | string | p_leaderboardName, |
System.Action< LeaderboardsDownloadedScoresEventArgs > | p_onDownloadedScores | ||
) |
Downloads the leaderboard with the given name. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores. SteamLeaderboardsMain.ScoreDownloadSource, SteamLeaderboardsMain.ScoreDownloadRangeStart and SteamLeaderboardsMain.ScoreDownloadRangeEnd will be used as filter critera.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to load. |
p_onDownloadedScores | invoked when the leaderboard is either fully loaded or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.DownloadScores | ( | string | p_leaderboardName, |
ELeaderboardDataRequest | p_scoreSource, | ||
int | p_rangeStart, | ||
int | p_rangeEnd, | ||
System.Action< LeaderboardsDownloadedScoresEventArgs > | p_onDownloadedScores | ||
) |
Downloads the leaderboard for the filter criteria. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to load. |
p_scoreSource | source of the leaderboard entries (Global, AroundUser, Friends). |
p_rangeStart | score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser. |
p_rangeEnd | score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser. |
p_onDownloadedScores | invoked when the leaderboard is either fully loaded or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.DownloadScoresAroundUser | ( | string | p_leaderboardName, |
int | p_range, | ||
System.Action< LeaderboardsDownloadedScoresEventArgs > | p_onDownloadedScores | ||
) |
Downloads the leaderboard entries around the current user's score record. The p_onDownloadedScores callback is invoked when done. First all score entries are fetched, then all user names are loaded if they are not yet cached by Steam. Avatars are loaded as soon as they are requested with SteamLeaderboardsMain.GetAvatarTexture. See also SteamLeaderboardsMain.OnDownloadedScores.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to load. |
p_range | number of entries to load (if possible, then user's entry will be in the middle of the returned list). |
p_onDownloadedScores | invoked when the leaderboard is either fully loaded or an error has occured. |
string LapinerTools.Steam.SteamLeaderboardsMain.FormatScore | ( | int | p_score, |
ELeaderboardDisplayType | p_scoreType | ||
) |
Formats p_score with SteamLeaderboardsMain.ScoreFormatNumeric or SteamLeaderboardsMain.ScoreFormatSeconds or SteamLeaderboardsMain.ScoreFormatMilliSeconds taking p_scoreType into account.
p_score | integer score value to format. |
p_scoreType | score display type of the target format. |
Texture2D LapinerTools.Steam.SteamLeaderboardsMain.GetAvatarTexture | ( | LeaderboardsScoreEntry | p_scoreEntry | ) |
If Steam has already downloaded the user's avatar, then it will be returned as Texture2D. Otherwise, will return null if the user has no avatar image at all or the image is still loading. Will start the download of the user's avatar if Steam is not yet loading it.
p_scoreEntry | score entry of the user to look for. |
Texture2D LapinerTools.Steam.SteamLeaderboardsMain.GetAvatarTexture | ( | CSteamID | p_steamIDUser | ) |
If Steam has already downloaded the user's avatar, then it will be returned as Texture2D. Otherwise, will return null if the user has no avatar image at all or the image is still loading. Will start the download of the user's avatar if Steam is not yet loading it.
p_steamIDUser | user ID to look for. |
bool LapinerTools.Steam.SteamLeaderboardsMain.IsAvatarTextureSet | ( | LeaderboardsScoreEntry | p_scoreEntry | ) |
Most users who didn't set their avatar have a question mark as their avatar texture. However, Steam allows to check if there is no texture set at all, which will probably never happen.
true
if the user of the given score entry has a custom avatar image or uses the default question mark texture as avatar; otherwise, false
.p_scoreEntry | score entry of the user to look for. |
bool LapinerTools.Steam.SteamLeaderboardsMain.IsAvatarTextureSet | ( | CSteamID | p_steamIDUser | ) |
Most users who didn't set their avatar have a question mark as their avatar texture. However, Steam allows to check if there is no texture set at all, which will probably never happen.
true
if the given user has a custom avatar image or uses the default question mark texture as avatar; otherwise, false
.p_steamIDUser | user ID to look for. |
|
protectedvirtual |
Reimplemented from LapinerTools.Steam.SteamMainBase< SteamLeaderboardsMain >.
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
If the leaderboard with the given name does not yet exist, then it will be created with the display type given in SteamLeaderboardsMain.ScoreType.
If the leaderboard with the given name does not yet exist, then it will be created with the sorting given in SteamLeaderboardsMain.ScoreSortMethod.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
ELeaderboardSortMethod | p_scoreSorting, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
If the leaderboard with the given name does not yet exist, then it will be created with the display type given in SteamLeaderboardsMain.ScoreType.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_scoreSorting | if the leaderboard with the given name does not yet exist, then it will be created with the given sorting |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
ELeaderboardDisplayType | p_scoreType, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
If the leaderboard with the given name does not yet exist, then it will be created with the sorting given in SteamLeaderboardsMain.ScoreSortMethod.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_scoreType | if the leaderboard with the given name does not yet exist, then it will be created with the given score display type |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
ELeaderboardSortMethod | p_scoreSorting, | ||
ELeaderboardDisplayType | p_scoreType, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_scoreSorting | if the leaderboard with the given name does not yet exist, then it will be created with the given sorting |
p_scoreType | if the leaderboard with the given name does not yet exist, then it will be created with the given score display type |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
ELeaderboardSortMethod | p_scoreSorting, | ||
ELeaderboardDisplayType | p_scoreType, | ||
string | p_scoreDetails, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_scoreSorting | if the leaderboard with the given name does not yet exist, then it will be created with the given sorting |
p_scoreType | if the leaderboard with the given name does not yet exist, then it will be created with the given score display type |
p_scoreDetails | additional game-defined information regarding how the user got that score. E.g. a replay, a screenshot, etc... |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
bool LapinerTools.Steam.SteamLeaderboardsMain.UploadScore | ( | string | p_leaderboardName, |
int | p_score, | ||
ELeaderboardSortMethod | p_scoreSorting, | ||
ELeaderboardDisplayType | p_scoreType, | ||
int [] | p_scoreDetails, | ||
System.Action< LeaderboardsUploadedScoreEventArgs > | p_onUploadedScore | ||
) |
Upload or update a score entry in the given leaderboard. The p_onUploadedScore callback is invoked when done.
See also SteamLeaderboardsMain.OnUploadedScore.
true
, if a request was started, false
when the request could not have been started due to an error.p_leaderboardName | name of the leaderboard to update. |
p_score | users score to submit. |
p_scoreSorting | if the leaderboard with the given name does not yet exist, then it will be created with the given sorting |
p_scoreType | if the leaderboard with the given name does not yet exist, then it will be created with the given score display type |
p_scoreDetails | additional game-defined information regarding how the user got that score. E.g. a replay, a screenshot, etc... |
p_onUploadedScore | invoked when the score upload is successfull or an error has occured. |
|
getset |
Determines the maximal integers count of additional score entry data downloaded from Steam. Could be used to load replays.
|
getset |
Score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser.
|
getset |
Score entries range to load. For example, [0,10] for Global, [-4,5] for AroundUser.
|
getset |
Define the leaderboard source here.
Global: global highscores.
AroundUser: scores around user's score (adapt range!).
Friends: scores for friends only.
|
getset |
The pattern used to format scores of MilliSeconds type.
|
getset |
The pattern used to format scores of Numeric type.
|
getset |
The pattern used to format scores of Seconds type.
|
getset |
If you use SteamLeaderboardsMain.UploadScore to create leaderboards, then set the correct sorting mode here. Alternatively, you can also pass the desired sorting mode to the SteamLeaderboardsMain.UploadScore method.
|
getset |
If you use SteamLeaderboardsMain.UploadScore to create leaderboards, then set the correct display type here. Alternatively, you can also pass the desired display type to the SteamLeaderboardsMain.UploadScore method.
|
getset |
Select when the users score should be updated here.
KeepBest: overwrite existing scores only with new records.
ForceUpdate: always overwrite existing scores.
System.Action<LeaderboardsDownloadedScoresEventArgs> LapinerTools.Steam.SteamLeaderboardsMain.OnDownloadedScores |
Invoked when the leaderboard score entries are fully loaded. See also SteamLeaderboardsMain.DownloadScores.
System.Action<LeaderboardsUploadedScoreEventArgs> LapinerTools.Steam.SteamLeaderboardsMain.OnUploadedScore |
Invoked when a score entry was successfully uploaded or updated. See also SteamLeaderboardsMain.UploadScore.