Added utility functions to trigger, find and reset

This commit is contained in:
Garry Newman 2017-05-09 20:30:29 +01:00
parent d1ada9464d
commit 2cff8ccea1

View File

@ -35,6 +35,30 @@ namespace Facepunch.Steamworks
client = null;
}
/// <summary>
/// Find an achievement by name. Will be null if not found, or not ready.
/// </summary>
public Achievement Find( string identifier )
{
return All.FirstOrDefault( x => x.Id == identifier );
}
/// <summary>
/// Unlock an achievement by identifier
/// </summary>
public bool Trigger( string identifier )
{
return client.native.userstats.SetAchievement( identifier );
}
/// <summary>
/// Reset an achievement by identifier
/// </summary>
public bool Reset( string identifier )
{
return client.native.userstats.ClearAchievement( identifier );
}
private void UserStatsReceived( UserStatsReceived_t stats, bool isError )
{
if ( isError ) return;