mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 14:48:02 +03:00
Added utility functions to trigger, find and reset
This commit is contained in:
parent
d1ada9464d
commit
2cff8ccea1
@ -35,6 +35,30 @@ namespace Facepunch.Steamworks
|
|||||||
client = null;
|
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 )
|
private void UserStatsReceived( UserStatsReceived_t stats, bool isError )
|
||||||
{
|
{
|
||||||
if ( isError ) return;
|
if ( isError ) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user