Beispiel #1
0
 public void TickStat(object o)
 {
     try
     {
         if (!this.Completed)
         {
             if (this.CustomAction != null)
             {
                 if (Achievements.ShowLogs)
                 {
                     Debug.Log(string.Concat(new string[]
                     {
                         "# Doing custom tick action for stat: ",
                         this.StatKey,
                         " [",
                         this.Key,
                         "]"
                     }));
                 }
                 if (!this.CustomAction(this, o))
                 {
                     return;
                 }
             }
             else
             {
                 if (Achievements.ShowLogs)
                 {
                     Debug.Log(string.Concat(new string[]
                     {
                         "# Ticking stat: ",
                         this.StatKey,
                         " [",
                         this.Key,
                         "]"
                     }));
                 }
                 AccountInfo.SetIntStat(this, this.CurrentValue + 1);
             }
         }
         if (this.Completed || AccountInfo.IsAchievementUnlocked(this))
         {
             if (Achievements.ShowLogs)
             {
                 Debug.Log("# Unlocked [" + this.Key + "] after ticking " + this.StatKey);
             }
             this.Completed = true;
             this.Clear();
         }
     }
     catch (Exception exception)
     {
         if (Achievements.ShowExceptions)
         {
             Debug.LogException(exception);
         }
     }
 }
Beispiel #2
0
 public AchievementData(string name, string description, string key, string statKey, List <int> unlockValues, EventRegistry reg, object evnt, Func <AchievementData, object, bool> customAction, Func <AchievementData, object, bool> setupAction = null)
 {
     try
     {
         this.Name         = name;
         this.Description  = description;
         this.Key          = key;
         this.StatKey      = statKey;
         this.UnlockValues = unlockValues;
         this.Registry     = reg;
         this.Event        = evnt;
         this.CustomAction = customAction;
         this.Init(AccountInfo.IsAchievementUnlocked(this), setupAction);
     }
     catch (Exception exception)
     {
         if (Achievements.ShowExceptions)
         {
             Debug.LogException(exception);
         }
     }
 }
Beispiel #3
0
 public void Unlock(object o)
 {
     try
     {
         if (this.CustomAction != null)
         {
             if (Achievements.ShowLogs)
             {
                 Debug.Log("# Doing custom unlock action for [" + this.Key + "]");
             }
             if (!this.CustomAction(this, o))
             {
                 return;
             }
         }
         else
         {
             if (Achievements.ShowLogs)
             {
                 Debug.Log("# Unlocked [" + this.Key + "]");
             }
             AccountInfo.UnlockAchievement(this);
         }
         if (this.Completed || AccountInfo.IsAchievementUnlocked(this))
         {
             this.Completed = true;
             this.Clear();
         }
     }
     catch (Exception exception)
     {
         if (Achievements.ShowExceptions)
         {
             Debug.LogException(exception);
         }
     }
 }