public override void draw(SpriteBatch b)
 {
     if (!this.onFarm && !Game1.dialogueUp && !Game1.globalFade)
     {
         b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
         SpriteText.drawStringWithScrollBackground(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11354"), this.xPositionOnScreen + 96, this.yPositionOnScreen, "", 1f, -1);
         Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, (string)null, false);
         Game1.dayTimeMoneyBox.drawMoneyBox(b, -1, -1);
         foreach (ClickableTextureComponent textureComponent in this.animalsToPurchase)
         {
             textureComponent.draw(b, (textureComponent.item as StardewValley.Object).Type != null ? Color.Black * 0.4f : Color.White, 0.87f);
         }
         SpriteText.drawStringWithScrollBackground(b, currentFarmDisplay, xPositionOnScreen + 86, yPositionOnScreen + 416, "farms farms    ", 1f, -1);
         farmSelectForwardButton.draw(b);
         farmSelectBackButton.draw(b);
     }
     else if (!Game1.globalFade && this.onFarm)
     {
         string s = Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11355", (object)this.animalBeingPurchased.displayHouse, (object)this.animalBeingPurchased.displayType);
         SpriteText.drawStringWithScrollBackground(b, s, Game1.viewport.Width / 2 - SpriteText.getWidthOfString(s) / 2, 16, "", 1f, -1);
         if (this.namingAnimal)
         {
             b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
             Game1.drawDialogueBox(Game1.viewport.Width / 2 - 256, Game1.viewport.Height / 2 - 192 - 32, 512, 192, false, true, (string)null, false);
             Utility.drawTextWithShadow(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11357"), Game1.dialogueFont, new Vector2((float)(Game1.viewport.Width / 2 - 256 + 32 + 8), (float)(Game1.viewport.Height / 2 - 128 + 8)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3);
             this.textBox.Draw(b, true);
             this.doneNamingButton.draw(b);
             this.randomButton.draw(b);
         }
     }
     if (!Game1.globalFade && this.okButton != null)
     {
         this.okButton.draw(b);
     }
     if (this.hovered != null)
     {
         if ((this.hovered.item as StardewValley.Object).Type != null)
         {
             IClickableMenu.drawHoverText(b, Game1.parseText((this.hovered.item as StardewValley.Object).Type, Game1.dialogueFont, 320), Game1.dialogueFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
         }
         else
         {
             string animalTitle = PurchaseAnimalsMenu.getAnimalTitle(this.hovered.hoverText);
             SpriteText.drawStringWithScrollBackground(b, animalTitle, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 64, this.yPositionOnScreen + this.height - 32 + IClickableMenu.spaceToClearTopBorder / 2 + 8, "Truffle Pig", 1f, -1);
             SpriteText.drawStringWithScrollBackground(b, "$" + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)this.hovered.item.salePrice()), this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 128, this.yPositionOnScreen + this.height + 64 + IClickableMenu.spaceToClearTopBorder / 2 + 8, "$99999999g", Game1.player.Money >= this.hovered.item.salePrice() ? 1f : 0.5f, -1);
             string animalDescription = PurchaseAnimalsMenu.getAnimalDescription(this.hovered.hoverText);
             IClickableMenu.drawHoverText(b, Game1.parseText(animalDescription, Game1.smallFont, 320), Game1.smallFont, 0, 0, -1, animalTitle, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
         }
     }
     Game1.mouseCursorTransparency = 1f;
     this.drawMouse(b);
 }
        public override void draw(SpriteBatch b)
        {
            if (!this.onFarm && !Game1.dialogueUp && !Game1.globalFade)
            {
                b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                SpriteText.drawStringWithScrollBackground(b, farmName[framework.expansionSelected(currentFarm.Name) ? 1 : 0], xPositionOnScreen + width / 4 + Game1.tileSize / 5, yPositionOnScreen, "Expansion", 1f, -1);
                SpriteText.drawStringWithScrollBackground(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11354", new object[0]), this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize, this.yPositionOnScreen + this.height + -Game1.tileSize / 2 + IClickableMenu.spaceToClearTopBorder / 2, "Truffle Pig", 1f, -1);
                Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, null, false);
                Game1.dayTimeMoneyBox.drawMoneyBox(b, -1, -1);
                this.previousFarmButton.draw(b);
                this.nextFarmButton.draw(b);
                using (List <ClickableTextureComponent> .Enumerator enumerator = this.animalsToPurchase.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ClickableTextureComponent current = enumerator.Current;
                        current.draw(b, ((current.item as Object).Type != null) ? (Color.Black * 0.4f) : Color.White, 0.87f);
                    }
                    goto IL_2AE;
                }
            }
            if (!Game1.globalFade && this.onFarm)
            {
                string s = Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11355", new object[]
                {
                    this.animalBeingPurchased.displayHouse,
                    this.animalBeingPurchased.displayType
                });
                SpriteText.drawStringWithScrollBackground(b, s, Game1.viewport.Width / 2 - SpriteText.getWidthOfString(s) / 2, Game1.tileSize / 4, "", 1f, -1);
                if (this.namingAnimal)
                {
                    b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                    Game1.drawDialogueBox(Game1.viewport.Width / 2 - Game1.tileSize * 4, Game1.viewport.Height / 2 - Game1.tileSize * 3 - Game1.tileSize / 2, Game1.tileSize * 8, Game1.tileSize * 3, false, true, null, false);
                    Utility.drawTextWithShadow(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11357", new object[0]), Game1.dialogueFont, new Vector2((float)(Game1.viewport.Width / 2 - Game1.tileSize * 4 + Game1.tileSize / 2 + 8), (float)(Game1.viewport.Height / 2 - Game1.tileSize * 2 + 8)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3);
                    this.textBox.Draw(b);
                    this.doneNamingButton.draw(b);
                    this.randomButton.draw(b);
                }
            }
IL_2AE:
            if (!Game1.globalFade && this.okButton != null)
            {
                this.okButton.draw(b);
            }
            if (this.hovered != null)
            {
                if ((this.hovered.item as Object).Type != null)
                {
                    IClickableMenu.drawHoverText(b, Game1.parseText((this.hovered.item as Object).Type, Game1.dialogueFont, Game1.tileSize * 5), Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
                }
                else
                {
                    string animalTitle = PurchaseAnimalsMenu.getAnimalTitle(this.hovered.hoverText);
                    SpriteText.drawStringWithScrollBackground(b, animalTitle, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize + Game1.tileSize / 2, this.yPositionOnScreen + this.height + Game1.tileSize - Game1.tileSize / 4 + IClickableMenu.spaceToClearTopBorder / 2, "Truffle Pig", 1f, -1);
                    SpriteText.drawStringWithScrollBackground(b, "$" + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", new object[]
                    {
                        this.hovered.item.salePrice()
                    }), this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize * 2, this.yPositionOnScreen + this.height + Game1.tileSize * 2 + IClickableMenu.spaceToClearTopBorder / 2, "$99999999g", (Game1.player.Money >= this.hovered.item.salePrice()) ? 1f : 0.5f, -1);
                    string animalDescription = PurchaseAnimalsMenu.getAnimalDescription(this.hovered.hoverText);
                    IClickableMenu.drawHoverText(b, Game1.parseText(animalDescription, Game1.smallFont, Game1.tileSize * 5), Game1.smallFont, 0, 0, -1, animalTitle, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
                }
            }
            Game1.mouseCursorTransparency = 1f;
            base.drawMouse(b);
        }
        internal static void PurchaseAnimalsMenuPatch(PurchaseAnimalsMenu __instance, bool ___onFarm, bool ___namingAnimal, TextBox ___textBox)
        {
            try
            {
                int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                purchaseAnimalsMenu = __instance;
                isOnFarm            = ___onFarm;

                if (___onFarm && ___namingAnimal)
                {
                    string toSpeak = "";
                    if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
                    {
                        toSpeak = "Cancel Button";
                    }
                    else if (__instance.doneNamingButton != null && __instance.doneNamingButton.containsPoint(x, y))
                    {
                        toSpeak = "OK Button";
                    }
                    else if (__instance.randomButton != null && __instance.randomButton.containsPoint(x, y))
                    {
                        toSpeak = "Random Name Button";
                    }
                    else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
                    {
                        toSpeak = "Name Text Box";
                        string?value = ___textBox.Text;
                        if (value != "" && value != null && value != "null")
                        {
                            toSpeak = $"{toSpeak}, Value: {value}";
                        }
                    }

                    if (purchaseAnimalMenuQuery != toSpeak)
                    {
                        purchaseAnimalMenuQuery = toSpeak;

                        if (firstTimeInNamingMenu)
                        {
                            toSpeak = $"Enter the name of animal in the name text box. {toSpeak}";
                            firstTimeInNamingMenu = false;
                        }

                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                else if (___onFarm && !___namingAnimal)
                {
                    firstTimeInNamingMenu = true;
                }
                else if (!___onFarm && !___namingAnimal)
                {
                    firstTimeInNamingMenu = true;
                    if (__instance.hovered != null)
                    {
                        string toSpeak = "";
                        if (((StardewValley.Object)__instance.hovered.item).Type != null)
                        {
                            toSpeak = ((StardewValley.Object)__instance.hovered.item).Type;
                        }
                        else
                        {
                            string displayName = PurchaseAnimalsMenu.getAnimalTitle(__instance.hovered.hoverText);
                            int    price       = __instance.hovered.item.salePrice();
                            string description = PurchaseAnimalsMenu.getAnimalDescription(__instance.hovered.hoverText);

                            toSpeak = $"{displayName}, Price: {price}g, Description: {description}";
                        }

                        if (purchaseAnimalMenuQuery != toSpeak)
                        {
                            purchaseAnimalMenuQuery = toSpeak;
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }
                        return;
                    }
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }