private void OnRenderingActiveMenu(object sender, RenderingActiveMenuEventArgs e)
        {
            // Ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady || Game1.activeClickableMenu == null)
            {
                return;
            }

            if (!(Game1.activeClickableMenu is StardewValley.Menus.NamingMenu))
            {
                return;
            }

            StardewValley.Menus.NamingMenu namingMenu = Game1.activeClickableMenu as StardewValley.Menus.NamingMenu;

            if (namingMenu.GetType() == typeof(StardewValley.Menus.NamingMenu))
            {
                Player player = new Player(Game1.player, this.Helper);

                // Set up everything else
                BlueConfig    blueConfig      = new BlueConfig(player.HasSeenEvent(BlueVariation.EVENT_ID));
                BlueVariation blueFarmAnimals = new BlueVariation(blueConfig);

                Dictionary <string, List <string> > farmAnimals = this.Config.GetFarmAnimalTypes();
                BreedFarmAnimalConfig breedFarmAnimalConfig     = new BreedFarmAnimalConfig(farmAnimals, blueFarmAnimals, this.Config.RandomizeNewbornFromCategory, this.Config.RandomizeHatchlingFromCategory, this.Config.IgnoreParentProduceCheck);
                BreedFarmAnimal       breedFarmAnimal           = new BreedFarmAnimal(player, breedFarmAnimalConfig);

                NameFarmAnimalMenu nameFarmAnimalMenu = new NameFarmAnimalMenu(namingMenu, breedFarmAnimal);

                nameFarmAnimalMenu.HandleChange();
            }
        }
Esempio n. 2
0
        private void Display_RenderingActiveMenu(object sender, RenderingActiveMenuEventArgs e)
        {
            // Ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady || Game1.activeClickableMenu == null)
            {
                return;
            }

            StardewValley.Menus.NamingMenu namingMenu = Game1.activeClickableMenu as StardewValley.Menus.NamingMenu;

            if (namingMenu == null)
            {
                return;
            }

            if (namingMenu.GetType() != typeof(StardewValley.Menus.NamingMenu))
            {
                return;
            }

            List <string>         loadedTypes           = this.Config.GetFarmAnimalTypes();
            BreedFarmAnimalConfig breedFarmAnimalConfig = new BreedFarmAnimalConfig(loadedTypes, this.BlueFarmAnimals);
            BreedFarmAnimal       breedFarmAnimal       = new BreedFarmAnimal(this.Player, breedFarmAnimalConfig);

            NameFarmAnimalMenu nameFarmAnimalMenu = new NameFarmAnimalMenu(namingMenu, breedFarmAnimal);

            nameFarmAnimalMenu.HandleChange();
        }