Example #1
0
        public AnimalQueryMenuExtended(FarmAnimal farmAnimal) : base(farmAnimal)
        {
            _farmAnimal = farmAnimal;
            if (Context.IsMainPlayer && !DataLoader.ModConfig.DisablePregnancy)
            {
                if (PregnancyController.IsAnimalPregnant(this._farmAnimal.myID.Value))
                {
                    this.allowReproductionButton = null;
                    pregnantStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.pixelZoom * 3,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth + Game1.pixelZoom,
                            Game1.pixelZoom * 11, Game1.pixelZoom * 11), DataLoader.LooseSprites,
                        new Microsoft.Xna.Framework.Rectangle(34, 29, 11, 11), 4f, false);
                }
            }

            if (Context.IsMainPlayer && !DataLoader.ModConfig.DisableTreats && TreatsController.CanReceiveTreat(farmAnimal))
            {
                if (TreatsController.IsReadyForTreat(farmAnimal))
                {
                    treatStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth,
                            Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites,
                        new Microsoft.Xna.Framework.Rectangle(240, 0, 16, 16), 4f, false);
                }
                else
                {
                    treatStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth,
                            Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites,
                        new Microsoft.Xna.Framework.Rectangle(16, 28, 16, 16), 4f, false);
                }
            }

            if (AnimalContestController.IsParticipant(farmAnimal))
            {
                animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(256, 0, 16, 16), 4f, false);
            }

            if (!DataLoader.ModConfig.DisableMeat && MeatController.CanGetMeatFrom(farmAnimal))
            {
                if (!this._farmAnimal.isBaby())
                {
                    meatButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(0, 28, 16, 16), 4f, false);
                }
            }

            _parentName     = DataLoader.Helper.Reflection.GetField <String>(this, "parentName").GetValue();
            _textBox        = DataLoader.Helper.Reflection.GetField <TextBox>(this, "textBox").GetValue();
            _movingAnimal   = DataLoader.Helper.Reflection.GetField <bool>(this, "movingAnimal");
            _confirmingSell = DataLoader.Helper.Reflection.GetField <bool>(this, "confirmingSell");
            _lovelLevel     = DataLoader.Helper.Reflection.GetField <double>(this, "loveLevel");
            _hoverText      = DataLoader.Helper.Reflection.GetField <string>(this, "hoverText");
        }
Example #2
0
        public AnimalQueryMenuExtended(FarmAnimal farmAnimal) : base(farmAnimal)
        {
            _farmAnimal = farmAnimal;
            if (!DataLoader.ModConfig.DisablePregnancy)
            {
                if (PregnancyController.IsAnimalPregnant(this._farmAnimal))
                {
                    pregnantStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.pixelZoom * 3,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth + Game1.pixelZoom,
                            Game1.pixelZoom * 11, Game1.pixelZoom * 11), DataLoader.LooseSprites,
                        new Microsoft.Xna.Framework.Rectangle(34, 29, 11, 11), 4f, false)
                    {
                        myID            = region_allowReproductionButton,
                        downNeighborID  = region_okButton,
                        upNeighborID    = region_sellButton,
                        rightNeighborID = region_treatStatus
                    };
                    this.okButton.upNeighborID     = region_allowReproductionButton;
                    this.sellButton.downNeighborID = region_allowReproductionButton;
                    if (Game1.options.SnappyMenus)
                    {
                        this.allClickableComponents.Remove(this.allowReproductionButton);
                        this.allClickableComponents.Add(pregnantStatus);
                    }
                    this.allowReproductionButton = null;
                }
            }

            if (!DataLoader.ModConfig.DisableTreats && TreatsController.CanReceiveTreat(farmAnimal))
            {
                if (TreatsController.IsReadyForTreat(farmAnimal))
                {
                    treatStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth,
                            Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites,
                        new Microsoft.Xna.Framework.Rectangle(240, 0, 16, 16), 4f, false)
                    {
                        myID           = region_treatStatus,
                        leftNeighborID = region_allowReproductionButton
                    };
                }
                else
                {
                    treatStatus = new ClickableTextureComponent(
                        new Microsoft.Xna.Framework.Rectangle(
                            this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4,
                            this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth,
                            Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites,
                        new Microsoft.Xna.Framework.Rectangle(16, 28, 16, 16), 4f, false)
                    {
                        myID           = region_treatStatus,
                        leftNeighborID = region_allowReproductionButton
                    };
                }
                if (this.allowReproductionButton != null)
                {
                    this.allowReproductionButton.rightNeighborID = region_treatStatus;
                }
                if (Game1.options.SnappyMenus)
                {
                    this.allClickableComponents.Add(treatStatus);
                }
            }

            if (AnimalContestController.HasWon(farmAnimal))
            {
                animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(AnimalContestController.HasFertilityBonus(this._farmAnimal) ? 48 : 64, 29, 16, 15), 4f, false)
                {
                    myID           = region_animalConstestIndicator,
                    leftNeighborID = region_moveHomeButton
                };
                this.moveHomeButton.rightNeighborID = region_animalConstestIndicator;
                if (Game1.options.SnappyMenus)
                {
                    this.allClickableComponents.Add(animalContestIndicator);
                }
            }
            else if (farmAnimal.GetDayParticipatedContest() != null)
            {
                animalContestIndicator = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.ToolsSprites, new Microsoft.Xna.Framework.Rectangle(256, 0, 16, 16), 4f, false)
                {
                    myID           = region_animalConstestIndicator,
                    leftNeighborID = region_moveHomeButton
                };
                this.moveHomeButton.rightNeighborID = region_animalConstestIndicator;
                if (Game1.options.SnappyMenus)
                {
                    this.allClickableComponents.Add(animalContestIndicator);
                }
            }

            if (!DataLoader.ModConfig.DisableMeat && MeatController.CanGetMeatFrom(farmAnimal))
            {
                if (!this._farmAnimal.isBaby())
                {
                    meatButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.tileSize + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), DataLoader.LooseSprites, new Microsoft.Xna.Framework.Rectangle(0, 28, 16, 16), 4f, false)
                    {
                        myID           = region_meatButton,
                        leftNeighborID = region_sellButton
                    };
                }
                this.sellButton.rightNeighborID = region_meatButton;
                if (Game1.options.SnappyMenus)
                {
                    this.allClickableComponents.Add(meatButton);
                }
            }

            if (this.animalContestIndicator != null)
            {
                this.moveHomeButton.rightNeighborID = region_animalConstestIndicator;
                if (this.meatButton != null)
                {
                    this.meatButton.upNeighborID = region_animalConstestIndicator;
                    this.animalContestIndicator.downNeighborID = region_meatButton;
                }
                else if (this.treatStatus != null)
                {
                    this.treatStatus.upNeighborID = region_animalConstestIndicator;
                    this.animalContestIndicator.downNeighborID = region_treatStatus;
                }
            }

            if (this.meatButton != null)
            {
                this.sellButton.rightNeighborID = region_meatButton;
                if (this.treatStatus != null)
                {
                    this.treatStatus.upNeighborID  = region_meatButton;
                    this.meatButton.downNeighborID = region_treatStatus;
                }
            }

            if (this.treatStatus != null)
            {
                if (this.pregnantStatus == null && this.allowReproductionButton == null)
                {
                    this.treatStatus.downNeighborID = region_okButton;
                    if (this.meatButton == null && this.animalContestIndicator == null)
                    {
                        this.treatStatus.upNeighborID  = region_sellButton;
                        this.okButton.upNeighborID     = region_treatStatus;
                        this.sellButton.downNeighborID = region_treatStatus;
                    }
                }
            }

            _parentName     = DataLoader.Helper.Reflection.GetField <String>(this, "parentName").GetValue();
            _textBox        = DataLoader.Helper.Reflection.GetField <TextBox>(this, "textBox").GetValue();
            _movingAnimal   = DataLoader.Helper.Reflection.GetField <bool>(this, "movingAnimal");
            _confirmingSell = DataLoader.Helper.Reflection.GetField <bool>(this, "confirmingSell");
            _lovelLevel     = DataLoader.Helper.Reflection.GetField <double>(this, "loveLevel");
            _hoverText      = DataLoader.Helper.Reflection.GetField <string>(this, "hoverText");
        }