// Load
    public void LoadData(CropsManagerData cropsManagerData)
    {
        // todo: call Initialise?
        PopulateCropsList();
        SortedList <int, int> cropsCount = cropsManagerData.cropsCount;

        for (int i = 0; i < cropsCount.Count; i++)
        {
            currentCropIndex++;
            int amount = cropsCount.Values[i];
            InstantiateCropItemBar(CROPS_LIST[i], amount);
        }
    }
Ejemplo n.º 2
0
    public void Save()
    {
        if (dontSave)
        {
            return;
        }

        DateTime         lastSaveTime     = DateTime.UtcNow;
        CropsManagerData cropsManagerData = cropsManager.SaveData();
        CoinManagerData  coinManagerData  = coinManager.SaveData();
        AllSaveData      allSaveData      = new AllSaveData(cropsManagerData, coinManagerData, lastSaveTime);
        BinaryFormatter  bf = new BinaryFormatter();
        //Application.persistentDataPath is a string, so if you wanted you can put that into debug.log if you want to know where save games are located
        FileStream file = File.Create(saveFilePath); //you can call it anything you want

        bf.Serialize(file, allSaveData);
        file.Close();
    }
Ejemplo n.º 3
0
 public AllSaveData(CropsManagerData cropsManagerData, CoinManagerData coinManagerData, DateTime lastSaveTime)
 {
     this.cropsManagerData = cropsManagerData;
     this.coinManagerData  = coinManagerData;
     this.lastSaveTime     = lastSaveTime;
 }