Inheritance: IAchievement
Example #1
0
 public void ReportProgress(string id, double progress, Action<bool> callback)
 {
     if (this.VerifyUser())
     {
         foreach (Achievement achievement in this.m_Achievements)
         {
             if ((achievement.id == id) && (achievement.percentCompleted <= progress))
             {
                 if (progress >= 100.0)
                 {
                     achievement.SetCompleted(true);
                 }
                 achievement.SetHidden(false);
                 achievement.SetLastReportedDate(DateTime.Now);
                 achievement.percentCompleted = progress;
                 if (callback != null)
                 {
                     callback(true);
                 }
                 return;
             }
         }
         foreach (AchievementDescription description in this.m_AchievementDescriptions)
         {
             if (description.id == id)
             {
                 bool completed = progress >= 100.0;
                 Achievement item = new Achievement(id, progress, completed, false, DateTime.Now);
                 this.m_Achievements.Add(item);
                 if (callback != null)
                 {
                     callback(true);
                 }
                 return;
             }
         }
         Debug.LogError("Achievement ID not found");
         if (callback != null)
         {
             callback(false);
         }
     }
 }
Example #2
0
 public override void Read(ES2Reader reader, object c)
 {
     UnityEngine.SocialPlatforms.Impl.Achievement data = (UnityEngine.SocialPlatforms.Impl.Achievement)c;
     // Add your reader.Read calls here to read the data into the object.
 }
Example #3
0
 public override void Write(object obj, ES2Writer writer)
 {
     UnityEngine.SocialPlatforms.Impl.Achievement data = (UnityEngine.SocialPlatforms.Impl.Achievement)obj;
     // Add your writer.Write calls here.
 }
Example #4
0
 public override object Read(ES2Reader reader)
 {
     UnityEngine.SocialPlatforms.Impl.Achievement data = new UnityEngine.SocialPlatforms.Impl.Achievement();
     Read(reader, data);
     return(data);
 }