Assembly-CSharp\AchievmentManager.cs Assembly-CSharp\AchievmentManager.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
   
public class AchievmentManager public class AchievmentManager
{ {
   private AchievmentManager()    private AchievmentManager()
   {    {
       this.collectedAchievments = new List<int>();        this.collectedAchievments = new List<int>();
   }    }
   
   public static AchievmentManager Instance    public static AchievmentManager Instance
   {    {
       get        get
       {        {
           if (AchievmentManager.instance == null)            if (AchievmentManager.instance == null)
           {            {
               AchievmentManager.instance = new AchievmentManager();                AchievmentManager.instance = new AchievmentManager();
           }            }
           return AchievmentManager.instance;            return AchievmentManager.instance;
       }        }
   }    }
   
   public void Init()    public void Init()
   {    {
       AchievmentsContainer.Instance.Load();        AchievmentsContainer.Instance.Load();
       this.LoadCollected();        this.LoadCollected();
   }    }
   
   private void SaveAchievment(int id)    private void SaveAchievment(int id)
   {    {
       PlayerPrefsController.SetInt("Achievment" + id.ToString(), this.collectedAchievments[id]);        PlayerPrefsController.SetInt("Achievment" + id.ToString(), this.collectedAchievments[id]);
   }    }
   
   public void LoadCollected()    public void LoadCollected()
   {    {
       int achievmentsCount = AchievmentsContainer.Instance.GetAchievmentsCount();        int achievmentsCount = AchievmentsContainer.Instance.GetAchievmentsCount();
       this.collectedAchievments.Clear();        this.collectedAchievments.Clear();
       for (int i = 0; i < achievmentsCount; i++)        for (int i = 0; i < achievmentsCount; i++)
       {        {
           int @int = PlayerPrefsController.GetInt("Achievment" + i.ToString(), 0);            int @int = PlayerPrefsController.GetInt("Achievment" + i.ToString(), 0);
           this.collectedAchievments.Add(@int);            this.collectedAchievments.Add(@int);
       }        }
   }    }
   
   public int GetLevel(int id)    public int GetLevel(int id)
   {    {
       if (id < 0 || id >= this.collectedAchievments.Count)        if (id < 0 || id >= this.collectedAchievments.Count)
       {        {
           return 0;            return 0;
       }        }
       return this.collectedAchievments[id];        return this.collectedAchievments[id];
   }    }
   
   public int GetMaxLevelSum()    public int GetMaxLevelSum()
   {    {
       int num = 0;        int num = 0;
       for (int i = 0; i < this.collectedAchievments.Count; i++)        for (int i = 0; i < this.collectedAchievments.Count; i++)
       {        {
           num += 10;            num += 10;
       }        }
       return num;        return num;
   }    }
   
   public int GetLevelsSum()    public int GetLevelsSum()
   {    {
       int num = 0;        int num = 0;
       for (int i = 0; i < this.collectedAchievments.Count; i++)        for (int i = 0; i < this.collectedAchievments.Count; i++)
       {        {
           num += this.collectedAchievments[i];            num += this.collectedAchievments[i];
       }        }
       return num;        return num;
   }    }
   
   public string GetDescription(int id)    public string GetDescription(int id)
   {    {
       if (id < 0 || id >= this.collectedAchievments.Count)        if (id < 0 || id >= this.collectedAchievments.Count)
       {        {
           return string.Empty;            return string.Empty;
       }        }
       return AchievmentsContainer.Instance.GetDescription(id, this.collectedAchievments[id]);        return AchievmentsContainer.Instance.GetDescription(id, this.collectedAchievments[id]);
   }    }
   
   public BigNumber GetAmountReq(int id)    public BigNumber GetAmountReq(int id)
   {    {
       if (id < 0 || id >= this.collectedAchievments.Count)        if (id < 0 || id >= this.collectedAchievments.Count)
       {        {
           return 0;            return 0;
       }        }
       return AchievmentsContainer.Instance.GetAmountReq(id, this.collectedAchievments[id]);        return AchievmentsContainer.Instance.GetAmountReq(id, this.collectedAchievments[id]);
   }    }
   
   public BigNumber GetAmountReq(AchievmentType ID)    public BigNumber GetAmountReq(AchievmentType ID)
   {    {
       if (ID < AchievmentType.Performance || ID >= (AchievmentType)this.collectedAchievments.Count)        if (ID < AchievmentType.Performance || ID >= (AchievmentType)this.collectedAchievments.Count)
       {        {
           return 0;            return 0;
       }        }
       return AchievmentsContainer.Instance.GetAmountReq((int)ID, this.collectedAchievments[(int)ID]);        return AchievmentsContainer.Instance.GetAmountReq((int)ID, this.collectedAchievments[(int)ID]);
   }    }
   
   public BigNumber GetReward(int id)    public BigNumber GetReward(int id)
   {    {
       if (id < 0 || id >= this.collectedAchievments.Count)        if (id < 0 || id >= this.collectedAchievments.Count)
       {        {
           return 0;            return 0;
       }        }
.        return AchievmentsContainer.Instance.GetReward(id, this.collectedAchievments[id]);        return 99999;
   }    }
   
   public void UpgradeAchievment(int id)    public void UpgradeAchievment(int id)
   {    {
       if (id < 0 || id >= this.collectedAchievments.Count)        if (id < 0 || id >= this.collectedAchievments.Count)
       {        {
           return;            return;
       }        }
       if (this.collectedAchievments[id] < AchievmentsContainer.Instance.GetMaxLevel(id))        if (this.collectedAchievments[id] < AchievmentsContainer.Instance.GetMaxLevel(id))
       {        {
           PlayerAmountController.Instance.PremiumAmount += this.GetReward(id);            PlayerAmountController.Instance.PremiumAmount += this.GetReward(id);
           List<int> list;            List<int> list;
           (list = this.collectedAchievments)[id] = list[id] + 1;            (list = this.collectedAchievments)[id] = list[id] + 1;
           this.SaveAchievment(id);            this.SaveAchievment(id);
           if (AchievmentManager.onAchievementsChanged != null)            if (AchievmentManager.onAchievementsChanged != null)
           {            {
               AchievmentManager.onAchievementsChanged();                AchievmentManager.onAchievementsChanged();
           }            }
       }        }
   }    }
   
   private static AchievmentManager instance;    private static AchievmentManager instance;
   
   private const string achievmentLabel = "Achievment";    private const string achievmentLabel = "Achievment";
   
   private List<int> collectedAchievments;    private List<int> collectedAchievments;
   
   public static Action onAchievementsChanged;    public static Action onAchievementsChanged;
} }