public static bool TryAchieved(this TrackableDictionary<int, UserAchievement> dict,
AchievementKey key)
{
UserAchievement ach;
if (dict.TryGetValue((int)key, out ach))
{
if (ach.AchieveTime.HasValue)
return false;
ach = new UserAchievement { AchieveTime = DateTime.UtcNow, Value = ach.Value };
dict[(int)key] = ach;
}
else
{
ach = new UserAchievement { AchieveTime = DateTime.UtcNow };
dict.Add((int)key, ach);
}
return true;
}