mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Added Friend.RequestUserStats()
This commit is contained in:
parent
86a8f80584
commit
18fbabaf2c
@ -168,6 +168,30 @@ public void GetStatInt()
|
||||
Assert.AreNotEqual( 0, deaths.GetInt() );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetFriendStats()
|
||||
{
|
||||
var friend = new Friend( 76561197965732579 ); // Hezzy
|
||||
|
||||
// Download stats
|
||||
var status = await friend.RequestUserStats();
|
||||
Assert.AreNotEqual( false, status );
|
||||
|
||||
var deaths = friend.GetStatInt( "deaths" );
|
||||
|
||||
Console.WriteLine( $"Hezzy has died {deaths} times" );
|
||||
|
||||
Assert.AreNotEqual( 0, deaths );
|
||||
|
||||
var unlocked = friend.GetAchievement( "COLLECT_100_WOOD" );
|
||||
Assert.AreNotEqual( false, unlocked );
|
||||
|
||||
var when = friend.GetAchievementUnlockTime( "COLLECT_100_WOOD" );
|
||||
Assert.AreNotEqual( when, DateTime.MinValue );
|
||||
|
||||
Console.WriteLine( $"Hezzy unlocked COLLECT_100_WOOD {when}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetStatGlobalInt()
|
||||
{
|
||||
|
@ -184,5 +184,16 @@ public bool SendMessage( string message )
|
||||
return SteamFriends.Internal.ReplyToFriendMessage( Id, message );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get download the latest user stats
|
||||
/// </summary>
|
||||
/// <returns>True if successful, False if failure</returns>
|
||||
public async Task<bool> RequestUserStats()
|
||||
{
|
||||
var result = await SteamUserStats.Internal.RequestUserStats( Id );
|
||||
return result.HasValue && result.Value.Result == Result.OK;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user