OpenHacknet/AchievementsManager.cs

26 lines
704 B
C#
Raw Normal View History

2015-10-27 23:04:18 -04:00
using Steamworks;
2015-10-27 22:34:58 -04:00
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;
}
}
}
}