mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Merge pull request #170 from paperjack93/master
Added FetchUsersScores to Leaderboard.cs
This commit is contained in:
commit
b86d7ff019
@ -321,6 +321,34 @@ public bool FetchScores( RequestType RequestType, int start, int end, FetchScore
|
||||
return true;
|
||||
}
|
||||
|
||||
public unsafe bool FetchUsersScores( RequestType RequestType, UInt64[] steamIds, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
|
||||
{
|
||||
|
||||
if ( IsError ) return false;
|
||||
if ( !IsValid ) return DeferOnCreated( () => FetchUsersScores( RequestType, steamIds, onSuccess, onFailure ), onFailure );
|
||||
|
||||
fixed(ulong* pointer = steamIds){
|
||||
|
||||
client.native.userstats.DownloadLeaderboardEntriesForUsers(BoardId, (IntPtr)pointer, steamIds.Length, (result, error) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
onFailure?.Invoke(Callbacks.Result.IOFailure);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_sEntryBuffer == null) _sEntryBuffer = new List<Entry>();
|
||||
else _sEntryBuffer.Clear();
|
||||
|
||||
ReadScores(result, _sEntryBuffer);
|
||||
onSuccess(_sEntryBuffer.ToArray());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnScores( LeaderboardScoresDownloaded_t result, bool error )
|
||||
{
|
||||
IsQuerying = false;
|
||||
|
Loading…
Reference in New Issue
Block a user