Ejemplo n.º 1
0
        public static void loadCustomFarmType(int id)
        {
            if (id < 5)
            {
                isCustomFarmLoaded = false;
                return;
            }

            isCustomFarmLoaded = true;
            CustomFarmEntry entry      = getEntryById(id);
            JsonSerializer  serializer = new JsonSerializer();
            string          jsonFile   = Path.Combine(entry.contentpack.DirectoryPath, "farmType.json");

            if (File.Exists(jsonFile))
            {
                using (StreamReader sr = new StreamReader(@jsonFile)) {
                    using (JsonReader reader = new JsonTextReader(sr)) {
                        loadedFarm             = (CustomFarmType)serializer.Deserialize(reader, typeof(CustomFarmType));
                        loadedFarm.contentpack = entry.contentpack;
                        if (loadedFarm.farmHouse != null)
                        {
                            isFarmHouseRelocated = true;
                        }
                        if (loadedFarm.greenHouse != null)
                        {
                            isGreenHouseRelocated = true;
                        }
                        if (loadedFarm.shippingBin != null)
                        {
                            isShippBinRelocated = true;
                        }
                        if (loadedFarm.mailBox != null)
                        {
                            isMailBoxRelocated = true;
                        }
                        if (loadedFarm.grandpaShrine != null)
                        {
                            isShrineRelocated = true;
                        }
                        if (loadedFarm.rabbitStatue != null)
                        {
                            isRabbitRelocated = true;
                        }
                        if (loadedFarm.petWaterBowl != null)
                        {
                            isWaterBowlRelocated = true;
                        }
                    }
                }
            }
            else
            {
                instance.Monitor.Log($"Could not find farmType.json in {entry.contentpack.DirectoryPath}! Cannot load map!", LogLevel.Error);
            }
        }
Ejemplo n.º 2
0
 //Should use C#'s properties, but we're too used to ISO C++
 public static void updateSelectedFarm(string name)
 {
     selectedFarm = getEntryByName(name);
 }