Пример #1
0
        //use to write AllSaves info to some .json file to store save
        private void SaveModInfo()
        {
            if (AllSaves == null)
            {
                AllSaves = new SaveCollection().Add(new Save(Game1.player.name, Game1.uniqueIDForThisGame));
            }

            Save currentSave = AllSaves.FindSave(Game1.player.name, Game1.uniqueIDForThisGame);

            if (currentSave.SaveSeed != ulong.MaxValue)
            {
                currentSave.TractorHouse.Clear();
                foreach (Building b in this.Farm.buildings)
                {
                    if (b is TractorHouse)
                    {
                        currentSave.AddTractorHouse(b.tileX, b.tileY);
                    }
                }
            }
            else
            {
                AllSaves.saves.Add(new Save(Game1.player.name, Game1.uniqueIDForThisGame));
                SaveModInfo();
                return;
            }
            this.Helper.WriteJsonFile <SaveCollection>("TractorModSave.json", AllSaves);
        }