Beispiel #1
0
        public AchievementCollection EndGetAchievements(IAsyncResult result)
        {
            uint numAch = SteamUserStats.GetNumAchievements();
            List <Achievement> achievements = new List <Achievement>((int)numAch);

            for (uint i = 0; i < numAch; i += 1)
            {
                string key  = SteamUserStats.GetAchievementName(i);
                string name = SteamUserStats.GetAchievementDisplayAttribute(key, "name");
                string desc = SteamUserStats.GetAchievementDisplayAttribute(key, "desc");
                string hide = SteamUserStats.GetAchievementDisplayAttribute(key, "hidden");
                bool   earned;
                uint   unlockTime;
                SteamUserStats.GetUserAchievementAndUnlockTime(
                    steamID,
                    key,
                    out earned,
                    out unlockTime
                    );
                DateTime unlockDT = new DateTime(1970, 1, 1, 0, 0, 0);
                unlockDT.AddSeconds(unlockTime);
                achievements.Add(new Achievement(
                                     key,
                                     name,
                                     desc,
                                     hide == "0",
                                     earned,
                                     unlockDT
                                     ));
            }
            statReceiveAction = null;
            return(new AchievementCollection(achievements));
        }
        public AchievementCollection EndGetAchievements(IAsyncResult result)
        {
            List <Achievement> achievements = new List <Achievement>();

            statReceiveAction = null;
            return(new AchievementCollection(achievements));
        }
 public IAsyncResult BeginGetAchievements(
     AsyncCallback callback,
     object asyncState
     )
 {
     if (statReceiveAction != null)
     {
         throw new InvalidOperationException();
     }
     statReceiveAction = new GamerAction(asyncState, callback);
     return(statReceiveAction);
 }
 public IAsyncResult BeginAwardAchievement(
     string achievementKey,
     AsyncCallback callback,
     object state
     )
 {
     if (statStoreAction != null)
     {
         // FIXME: Pray that we don't get overlap -flibit
         // throw new InvalidOperationException();
     }
     statStoreAction             = new GamerAction(state, callback);
     statStoreAction.IsCompleted = true;
     return(statStoreAction);
 }
Beispiel #5
0
 public IAsyncResult BeginAwardAchievement(
     string achievementKey,
     AsyncCallback callback,
     object state
     )
 {
     if (statStoreAction != null)
     {
         // FIXME: Pray that we don't get overlap -flibit
         // throw new InvalidOperationException();
     }
     SteamUserStats.SetAchievement(achievementKey);
     statStoreAction = new GamerAction(state, callback);
     SteamUserStats.StoreStats();
     return(statStoreAction);
 }
Beispiel #6
0
 public void EndAwardAchievement(IAsyncResult result)
 {
     statStoreAction = null;
 }