Added Leaderboard.AttachRemoteFile

This commit is contained in:
James King 2017-05-16 09:13:52 +01:00
parent 6ea0e366f5
commit 788145c265
2 changed files with 29 additions and 0 deletions

View File

@ -161,6 +161,32 @@ public bool AddScore( bool onlyIfBeatsOldScore, int score, int[] subscores = nul
return true;
}
public delegate void AttachRemoteFileCallback( bool success );
public bool AttachRemoteFile( RemoteFile file, AttachRemoteFileCallback callback = null )
{
if ( file.IsShared )
{
client.native.userstats.AttachLeaderboardUGC( BoardId, file.UGCHandle, ( result, error ) =>
{
callback?.Invoke( !error && result.Result == Result.OK );
} );
return true;
}
file.Share( success =>
{
if ( !success || !file.IsShared )
{
callback?.Invoke( false );
return;
}
AttachRemoteFile( file, callback );
} );
return true;
}
/// <summary>
/// Fetch a subset of scores. The scores end up in Results.
/// </summary>

View File

@ -113,6 +113,9 @@ public class RemoteFile
private ulong _ownerId;
public bool Exists { get; internal set; }
public bool IsShared { get { return _handle.Value != 0; } }
internal UGCHandle_t UGCHandle { get { return _handle; } }
public string FileName
{