Пример #1
0
        internal CropsTask(ModConfig config, CropsTaskId id)
        {
            _config = config;
            _id     = id;

            switch (id)
            {
            case CropsTaskId.UnwateredCropFarm:
            case CropsTaskId.UnharvestedCropFarm:
            case CropsTaskId.DeadCropFarm:
            case CropsTaskId.FruitTreesFarm:
                _index        = 0;
                _locationName = "Farm";
                break;

            case CropsTaskId.UnwateredCropWestIsland:
            case CropsTaskId.UnharvestedCropWestIsland:
            case CropsTaskId.DeadCropWestIsland:
            case CropsTaskId.FruitTreesWestIsland:
                _index        = 2;
                _locationName = "IslandWest";
                break;

            default:
                _index        = 1;
                _locationName = "Greenhouse";
                break;
            }

            SettingsMenu.ReportConfigChanged += SettingsMenu_ReportConfigChanged;
        }
Пример #2
0
        protected override void FirstScan()
        {
            if (_who == CropsTaskId.None)
            {
                _who = _id;
            }

            if (ObjectsNames.Count == 0)
            {
                PopulateObjectsNames();
            }

            if (_who != _id)
            {
                return;
            }

            GameLocation location = Game1.locations.OfType <Farm>().FirstOrDefault();

            foreach (var pair in location.terrainFeatures.Pairs)
            {
                if (pair.Value is FruitTree tree && tree.fruitsOnTree.Value > 0)
                {
                    FruitTrees[0].Add(new Tuple <Vector2, FruitTree>(pair.Key, tree));
                }
            }

            location = Game1.locations.FirstOrDefault(l => l.IsGreenhouse);
            foreach (var pair in location.terrainFeatures.Pairs)
            {
                if (pair.Value is FruitTree tree && tree.fruitsOnTree.Value > 0)
                {
                    FruitTrees[1].Add(new Tuple <Vector2, FruitTree>(pair.Key, tree));
                }
            }

            location = Game1.locations.FirstOrDefault(l => l.Name == "IslandWest");
            foreach (var pair in location.terrainFeatures.Pairs)
            {
                if (pair.Value is FruitTree tree && tree.fruitsOnTree.Value > 0)
                {
                    FruitTrees[2].Add(new Tuple <Vector2, FruitTree>(pair.Key, tree));
                }
            }
        }
Пример #3
0
        internal CropsTask(ModConfig config, CropsTaskId id)
        {
            _config = config;
            _id     = id;

            if (id == CropsTaskId.UnwateredCropFarm || id == CropsTaskId.UnharvestedCropFarm ||
                id == CropsTaskId.DeadCropFarm || id == CropsTaskId.FruitTreesFarm)
            {
                _index        = 0;
                _locationName = "Farm";
            }
            else
            {
                _index        = 1;
                _locationName = "Greenhouse";
            }

            SettingsMenu.ReportConfigChanged += SettingsMenu_ReportConfigChanged;
        }