Exemple #1
0
 public static bool Prefix(PurchaseAnimalsMenu __instance, int x, int y, bool ___freeze, bool ___onFarm, bool ___namingAnimal)
 {
     if (!Config.EnableMod || Game1.IsFading() || ___freeze || ___onFarm || ___namingAnimal)
     {
         return(true);
     }
     if (femaleButt != null && femaleButt.containsPoint(x, y))
     {
         currentSex = Sexes.Female;
     }
     else if (maleButt != null && maleButt.containsPoint(x, y))
     {
         currentSex = Sexes.Male;
     }
     else if (intersexButt != null && intersexButt.containsPoint(x, y))
     {
         currentSex = Sexes.Intersex;
     }
     else
     {
         return(true);
     }
     SMonitor.Log($"Set current sex to {currentSex}");
     return(false);
 }
Exemple #2
0
        private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            // Ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // We only care about left mouse clicks right now
            if (e.Button != SButton.MouseLeft)
            {
                return;
            }

            ActiveClickableMenu activeClickableMenu = new ActiveClickableMenu(Game1.activeClickableMenu);

            if (!activeClickableMenu.IsOpen())
            {
                return;
            }

            // Purchasing a new animal
            PurchaseAnimalsMenu purchaseAnimalsMenu = activeClickableMenu.GetMenu() as PurchaseAnimalsMenu;

            if (purchaseAnimalsMenu == null)
            {
                return;
            }

            PurchaseFarmAnimal            purchaseFarmAnimal     = new PurchaseFarmAnimal(this.Player, this.AnimalShop);
            PariteePurchaseFarmAnimalMenu purchaseFarmAnimalMenu = new PariteePurchaseFarmAnimalMenu(purchaseAnimalsMenu, purchaseFarmAnimal);

            purchaseFarmAnimalMenu.HandleTap(e);
        }
Exemple #3
0
        public static void SetUpAnimalsToPurchase(
            PurchaseAnimalsMenu menu,
            List <SDV.Object> stock,
            Dictionary <string, Texture2D> icons,
            out int iconHeight)
        {
            var purchaseComponents = GetAnimalsToPurchaseComponents(menu, stock, icons, out iconHeight);

            SetAnimalsToPurchase(menu, purchaseComponents);
        }
 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);
 }
Exemple #5
0
        public static List <ClickableTextureComponent> GetAnimalsToPurchaseComponents(
            PurchaseAnimalsMenu menu,
            List <SDV.Object> stock,
            Dictionary <string, Texture2D> icons,
            out int iconHeight)
        {
            iconHeight = 0;
            var textureComponentList = new List <ClickableTextureComponent>();

            for (var index = 0; index < stock.Count; ++index)
            {
                var    @object = stock[index];
                var    name1   = @object.salePrice().ToString();
                string label   = null;
                var    name2   = @object.Name;
                var    bounds  = new Rectangle(menu.xPositionOnScreen + IClickableMenu.borderWidth + index % 5 * 64 * 2,
                                               menu.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth / 2 +
                                               index / 5 * 85, 128, 64);
                var icon              = icons[@object.Name];
                var sourceRect        = new Rectangle(0, 0, icon.Width, icon.Height);
                var scale             = 4f;
                var drawShadow        = @object.Type == null;
                var textureComponent1 =
                    new ClickableTextureComponent(name1, bounds, label, name2, icon, sourceRect, scale, drawShadow);
                textureComponent1.item            = @object;
                textureComponent1.myID            = index;
                textureComponent1.rightNeighborID = index % 5 == 2 ? -1 : index + 1;
                textureComponent1.leftNeighborID  = index % 5 == 0 ? -1 : index - 1;
                textureComponent1.downNeighborID  = index + 5;
                textureComponent1.upNeighborID    = index - 5;
                var textureComponent2 = textureComponent1;
                textureComponentList.Add(textureComponent2);
                iconHeight = icon.Height > iconHeight ? icon.Height : iconHeight;
            }

            return(textureComponentList);
        }
Exemple #6
0
 public static bool Prefix(PurchaseAnimalsMenu __instance, int x, int y, bool ___freeze, bool ___onFarm, bool ___namingAnimal)
 {
     if (!Config.EnableMod || Game1.IsFading() || ___freeze || ___onFarm || ___namingAnimal)
     {
         return(true);
     }
     if (maleButt != null && maleButt.containsPoint(x, y))
     {
         hoveredComponent = maleButt;
     }
     else if (femaleButt != null && femaleButt.containsPoint(x, y))
     {
         hoveredComponent = femaleButt;
     }
     else if (intersexButt != null && intersexButt.containsPoint(x, y))
     {
         hoveredComponent = intersexButt;
     }
     else
     {
         hoveredComponent = null;
     }
     return(true);
 }
Exemple #7
0
 public static void SetPriceOfAnimal(PurchaseAnimalsMenu menu, int price)
 {
     Reflection.GetField(menu, "priceOfAnimal").SetValue(menu, price);
 }
Exemple #8
0
 public static int GetPriceOfAnimal(PurchaseAnimalsMenu menu)
 {
     return(Reflection.GetFieldValue <int>(menu, "priceOfAnimal"));
 }
Exemple #9
0
 public static void SetAnimalBeingPurchased(PurchaseAnimalsMenu menu, SDV.FarmAnimal animal)
 {
     Reflection.GetField(menu, "animalBeingPurchased").SetValue(menu, animal);
 }