mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Added Leaderboard.AttachRemoteFile
This commit is contained in:
parent
6ea0e366f5
commit
788145c265
@ -161,6 +161,32 @@ public bool AddScore( bool onlyIfBeatsOldScore, int score, int[] subscores = nul
|
|||||||
return true;
|
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>
|
/// <summary>
|
||||||
/// Fetch a subset of scores. The scores end up in Results.
|
/// Fetch a subset of scores. The scores end up in Results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -113,6 +113,9 @@ public class RemoteFile
|
|||||||
private ulong _ownerId;
|
private ulong _ownerId;
|
||||||
|
|
||||||
public bool Exists { get; internal set; }
|
public bool Exists { get; internal set; }
|
||||||
|
public bool IsShared { get { return _handle.Value != 0; } }
|
||||||
|
|
||||||
|
internal UGCHandle_t UGCHandle { get { return _handle; } }
|
||||||
|
|
||||||
public string FileName
|
public string FileName
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user