OpenHacknet/AchievementsManager.cs
2015-10-27 23:04:18 -04:00

26 lines
No EOL
704 B
C#

using Steamworks;
namespace Hacknet
{
public static class AchievementsManager
{
public static bool Unlock(string name, bool recordAndCheckFlag = false)
{
try
{
var flag = name + "_Unlocked";
if (recordAndCheckFlag && OS.currentInstance.Flags.HasFlag(flag))
return false;
SteamUserStats.SetAchievement(name);
if (!SteamUserStats.StoreStats())
return false;
OS.currentInstance.Flags.AddFlag(flag);
return true;
}
catch
{
return false;
}
}
}
}