Ejemplo n.º 1
0
 void Awake()
 {
     if (ID == 0)
     {
         Debug.LogError("WARNING: THE ID of Upgrade Cannot be 0");
     }
     if (LastTouchedID == 0)
     {
         BuyButton.gameObject.SetActive(false);
         CostText.text    = "";
         DetailsText.text = "";
     }
     Saver = new eSave();
     if (Saver.isSaved(ID.ToString()))
     {
         Level = Saver.LoadInt(ID.ToString());
     }
     Costs = new decimal[Cost.Length];
     for (int i = 0; i < Costs.Length; i++)
     {
         Costs[i] = System.Convert.ToDecimal(Cost[i]);
     }
     IdleEngineMain.OnSave += Save;
     GeneratedLevels        = Saver.LoadInt(ID.ToString() + "TotalNew");
     if (Level == MaxLevel)
     {
         Destroy(gameObject);
     }
     LastTouchedID = 0;
 }
Ejemplo n.º 2
0
    void Load()
    {
        eSave loader = new eSave();

        if (loader.isSaved("MaxLevel"))
        {
            if (OnLoad != null)
            {
                OnLoad();
            }
            DateTime LastPlayDay = loader.LoadDateTime("LastPlayTime");
            Money            = loader.LoadDecimal("Money");
            MoneyMultiplier  = loader.LoadDecimal("MoneyM");
            Score            = loader.LoadDecimal("Score");
            TapPerSec        = loader.LoadFloat("TPS");
            IdleMoneyPerSec  = loader.LoadDecimal("IdleMoney");
            DamageMultiplier = loader.LoadDecimal("DamageM");
            CurrentItem      = loader.LoadInt("CurItem");
            Damage           = loader.LoadDecimal("Damage");
            MaxLevelUnlocked = (loader.LoadInt("MaxLevel"));
            if (PlayerPrefs.GetInt("GI") > 0)
            {
                MaxLevelUnlocked = Items.Length - 1;
            }
            TimeSpan TotalTime = DateTime.Now - LastPlayDay;
            TotalSec = (decimal)TotalTime.TotalSeconds;
            MoneyGot = (TotalSec * IdleMoneyPerSec * util.ConvertToDecimal(Items[CurrentItem].RewardPrice) / 2);
            Money   += MoneyGot;;
            if (MoneyGot > 0.000001m)
            {
                MoneyGotText.text = BigNumber.ShortNumber(MoneyGot);
            }
        }
    }
Ejemplo n.º 3
0
 void Start()
 {
     saver = new eSave();
     if (saver.isSaved("Gems"))
     {
         Gems       = saver.LoadInt("Gems");
         GemChances = saver.LoadInt("GeC");
     }
     IdleItem.OnDeath      += GemLuck;
     IdleEngineMain.OnSave += Save;
 }
Ejemplo n.º 4
0
    public void Load()
    {
        eSave Saver = new eSave();

        if (!Saver.isSaved("Money"))
        {
            return;
        }
        for (int i = 0; i < Variables.Length; i++)
        {
            if (Variables[i].Save)
            {
                Variables[i].Value       = Saver.LoadDecimal(Variables[i].Name + GetInstanceID());
                Variables[i].ValueOnLoad = Variables[i].Value;
            }
        }
    }