Beispiel #1
0
        private void OpenHorseMenu(Nullable <int> x = null, Nullable <int> y = null)
        {
            if (x == null && y == null)
            {
                String horseName = Game1.player.horseName;

                if (horseName == null)
                {
                    return;
                }

                HorseData horseData = LoadTempHorseDataForPlayer(Game1.player.name);

                if (horseData == null)
                {
                    horseData = new HorseData(0, false);
                }

                UpgradedHorse horse = new UpgradedHorse(
                    horseName, horseData
                    );

                Game1.activeClickableMenu = (IClickableMenu) new HorseMenu(horse, this);
                return;
            }

            if (Game1.activeClickableMenu is GameMenu menu)
            {
                if (menu.currentTab == INVENTORY_TAB)
                {
                    Vector2 rectangle = new Vector2((float)((double)(openMenuX + Game1.tileSize * 5 + Game1.pixelZoom * 2) + (double)Math.Max((float)Game1.tileSize, Game1.dialogueFont.MeasureString(Game1.player.name).X / 2f) + (Game1.player.getPetDisplayName() != null ? (double)Math.Max((float)Game1.tileSize, Game1.dialogueFont.MeasureString(Game1.player.getPetDisplayName()).X) : 0.0)), (float)(openMenuY + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 7 * Game1.tileSize - Game1.pixelZoom));
                    if (Utility.distance((float)x, rectangle.X, (float)y, rectangle.Y) <= 100)
                    {
                        String horseName = Game1.player.horseName;

                        if (horseName == null)
                        {
                            return;
                        }

                        HorseData horseData = LoadTempHorseDataForPlayer(Game1.player.name);

                        if (horseData == null)
                        {
                            horseData = new HorseData(0, false);
                        }

                        UpgradedHorse horse = new UpgradedHorse(
                            horseName, horseData
                            );

                        Game1.activeClickableMenu = (IClickableMenu) new HorseMenu(horse, this);
                        return;
                    }
                }
            }
        }
Beispiel #2
0
        public HorseMenu(UpgradedHorse horse, ModEntry mod)
            : base(Game1.viewport.Width / 2 - HorseMenu.width / 2, Game1.viewport.Height / 2 - HorseMenu.height / 2, HorseMenu.width, HorseMenu.height, false)
        {
            this.mod = mod;
            Game1.player.Halt();
            HorseMenu.width  = Game1.tileSize * 6;
            HorseMenu.height = Game1.tileSize * 8;

            this.horse          = horse;
            this.textBox        = new TextBox((Texture2D)null, (Texture2D)null, Game1.dialogueFont, Game1.textColor);
            this.textBox.X      = Game1.viewport.Width / 2 - Game1.tileSize * 2 - 12;
            this.textBox.Y      = this.yPositionOnScreen - 4 + Game1.tileSize * 2;
            this.textBox.Width  = Game1.tileSize * 4;
            this.textBox.Height = Game1.tileSize * 3;

            this.textBoxCC = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(this.textBox.X, this.textBox.Y, this.textBox.Width, Game1.tileSize), "")
            {
                myID           = 110,
                downNeighborID = 104
            };
            this.textBox.Text = horse.displayName;

            this.textBox.Selected = false;

            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + HorseMenu.width + 4, this.yPositionOnScreen + HorseMenu.height - Game1.tileSize - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            int num1 = 101;

            textureComponent1.myID = num1;
            int num2 = 103;

            textureComponent1.upNeighborID = num2;
            this.okButton = textureComponent1;



            ClickableTextureComponent textureComponent5 = new ClickableTextureComponent(
                (horse.horseData.Friendship / 10.0).ToString() + "<",
                new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize / 2 + 16, this.yPositionOnScreen - Game1.tileSize / 2 + IClickableMenu.spaceToClearTopBorder + Game1.tileSize * 4 - Game1.tileSize / 2, HorseMenu.width - Game1.tileSize * 2, Game1.tileSize), (string)null, "Friendship", Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(172, 512, 16, 16), 4f, false);
            int num10 = 102;

            textureComponent5.myID = num10;
            this.love      = textureComponent5;
            this.loveHover = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + Game1.tileSize * 3 - Game1.tileSize / 2, HorseMenu.width, Game1.tileSize), "Friendship")
            {
                myID = 109
            };

            this.friendshipLevel = horse.horseData.Friendship / 1000.0;
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }