Esempio n. 1
0
        public override void draw(SpriteBatch b)
        {
            int menuX = (int)Utility.getTopLeftPositionForCenteringOnScreen(980, 470).X;
            int menuY = (int)Utility.getTopLeftPositionForCenteringOnScreen(980, 470).Y;

            b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.White * 0.4f);

            /*  var day = Game1.dayOfMonth;
             * string season = Game1.currentSeason;
             * var year = Game1.year;*/
            //string years = "Year";
            //string dayof = "Day";
            //b.Draw(Game1.menuTexture, new Rectangle(xPositionOnScreen, yPositionOnScreen, width, height), Color.White);
            Vector2 titleSize = Game1.dialogueFont.MeasureString("Today: XX Day of Season Year XX Viewing Entry: XX Season XX Page XXX");

            //string dateText = this.Helper.Translation.Get("date", { day = 1, season = "summer", year = 1 });
            drawTextureBox(b, menuX - 455, menuY - 310, (int)titleSize.X + 32, (int)titleSize.Y + 32, Color.White);
            Utility.drawTextWithShadow(b, $"Today: Day {day} of {season} Year {year}  Viewing Entry: {currentDate} Page {currentPage + 1}", Game1.dialogueFont, new Vector2(32, 16), Game1.textColor);
            drawTextureBox(b, menuX - 445, menuY - 230, width + 900, height + 500, Color.White);
            displayedText.Draw(b);
            backButton.draw(b);
            nextButton.draw(b);
            previousDay.draw(b);
            nextDay.draw(b);
            exportDiary.draw(b);
            backMonth.draw(b);
            nextMonth.draw(b);
            if (this.backButton.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Back (Page)", Game1.smallFont);
            }
            if (this.nextButton.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Next (Page)", Game1.smallFont);
            }
            if (this.previousDay.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Back (Day)", Game1.smallFont);
            }
            if (this.nextDay.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Next (Day)", Game1.smallFont);
            }
            if (this.exportDiary.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Export to text!", Game1.smallFont);
            }
            if (this.backMonth.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Back (Season)", Game1.smallFont);
            }
            if (this.nextMonth.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
            {
                IClickableMenu.drawHoverText(b, "Next (Season)", Game1.smallFont);
            }

            //base.draw(b);
            //draw mouse
            drawMouse(b);
        }
Esempio n. 2
0
        public override void draw(SpriteBatch b)
        {
            base.draw(b);

            var gameMenu = ( GameMenu )Game1.activeClickableMenu;

            if (gameMenu.currentTab != 8)
            {
                yPositionOnScreen = Game1.activeClickableMenu.yPositionOnScreen + 16;
            }
            else
            {
                yPositionOnScreen = Game1.activeClickableMenu.yPositionOnScreen + 24;
            }

            // Draw tab
            Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen, yPositionOnScreen), new Rectangle(16, 368, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 1f);

            // Draw icon
            b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 8, yPositionOnScreen + 14), new Rectangle(128 / 4, 2688 / 4, 64 / 4, 64 / 4), Color.White, 0, Vector2.Zero, 3f, SpriteEffects.None, 1);

            // Draw hover text
            if (bounds.Contains(Game1.getMouseX(), Game1.getMouseY()))
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, "Mod Options", Game1.smallFont);
            }

            drawMouse(b);
        }
Esempio n. 3
0
        /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnRenderedHud(object sender, RenderedHudEventArgs e)
        {
            // draw hover text
            if (Constants.TargetPlatform == GamePlatform.Android)
            {
                if (_birthdayNPC != null &&
                    (_birthdayIcon?.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)) ?? false))
                {
                    String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
                    IClickableMenu.drawHoverText(
                        Game1.spriteBatch,
                        hoverText,
                        Game1.dialogueFont);
                }
                return;
            }

            if (_birthdayNPC != null &&
                (_birthdayIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
            {
                String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
                IClickableMenu.drawHoverText(
                    Game1.spriteBatch,
                    hoverText,
                    Game1.dialogueFont);
            }
        }
Esempio n. 4
0
        public void draw(SpriteBatch b)
        {
            var gameMenu = (GameMenu)Game1.activeClickableMenu;

            b.Draw(Game1.mouseCursors, new Vector2(bounds.X, bounds.Y + (gameMenu.currentTab == 8 ? 8 : 0)), new Rectangle(16, 368, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.0001f);

            // Draw icon
            b.Draw(Game1.mouseCursors, new Vector2((float)bounds.X + 8, (float)(bounds.Y + (gameMenu.currentTab == 8 ? 8 : 0)) + 14), new Rectangle(32, 672, 16, 16), Color.White, 0, Vector2.Zero, 3f, SpriteEffects.None, 1);
            if (containsPoint(Game1.getMouseX(), Game1.getMouseY()))
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, base.label, Game1.smallFont);
            }

            string hoverText = Helper.Reflection.GetField <string>(Game1.activeClickableMenu, "hoverText").GetValue();

            // Redraw hover text so that it overlaps icon
            if (hoverText == "Exit Game")
            {
                Utilities.drawHoverTextWithoutShadow(b, "Exit Game", Game1.smallFont);
            }

            //IClickableMenu.drawMouse(b);
            if (!Game1.options.hardwareCursor)
            {
                b.Draw(Game1.mouseCursors, new Vector2(Game1.getMouseX(), Game1.getMouseY()), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, (!Game1.options.SnappyMenus) ? 0 : 44, 16, 16)), Color.White * Game1.mouseCursorTransparency, 0f, Vector2.Zero, Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 1f);
            }
        }
Esempio n. 5
0
 private void DrawHoverTextOverEverything(object sender, EventArgs e)
 {
     if (_icon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
     {
         IClickableMenu.drawHoverText(Game1.spriteBatch, _hoverText, Game1.dialogueFont);
     }
 }
Esempio n. 6
0
 public static void DrawUnderwearIcon(Underwear underwear, int x, int y)
 {
     if (underwear.CleanStatus == 1)
     {
         Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "drying", 16)), Microsoft.Xna.Framework.Color.White);
     }
     else
     {
         Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "clean", 16)), Microsoft.Xna.Framework.Color.White);
         int height1 = Math.Min((int)((double)underwear.Wetness / (double)underwear.absorbency * 16.0), 16);
         int height2 = Math.Min((int)((double)underwear.Messiness / (double)underwear.containment * 16.0), 16);
         if (height1 > 0 && height1 >= height2)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White);
         }
         if (height2 > 0)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height2 * 4), 64, height2 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "messy", height2)), Microsoft.Xna.Framework.Color.White);
         }
         if (height1 > 0 && height1 < height2)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White);
         }
         if (Game1.getMouseX() >= x && Game1.getMouseX() <= x + 64 && Game1.getMouseY() >= y && Game1.getMouseY() <= y + 64)
         {
             string source = Strings.DescribeUnderwear(underwear, (string)null);
             string text   = source.First <char>().ToString().ToUpper() + source.Substring(1);
             int    width  = Game1.tileSize * 6 + Game1.tileSize / 6;
             IClickableMenu.drawHoverText(Game1.spriteBatch, Game1.parseText(text, Game1.tinyFont, width), Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
         }
     }
 }
 /// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnRenderedHud(object sender, RenderedHudEventArgs e)
 {
     // draw hover text
     if (Constants.TargetPlatform == GamePlatform.Android)
     {
         if (_drawQueenOfSauceIcon &&
             _queenOfSauceIcon.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)))
         {
             IClickableMenu.drawHoverText(
                 Game1.spriteBatch,
                 _helper.SafeGetString(
                     LanguageKeys.TodaysRecipe) + _todaysRecipe,
                 Game1.dialogueFont);
         }
         return;
     }
     if (_drawQueenOfSauceIcon &&
         _queenOfSauceIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
     {
         IClickableMenu.drawHoverText(
             Game1.spriteBatch,
             _helper.SafeGetString(
                 LanguageKeys.TodaysRecipe) + _todaysRecipe,
             Game1.dialogueFont);
     }
 }
Esempio n. 8
0
        public override void draw(SpriteBatch b)
        {
            if (activeWindowSize != currentActiveSize())
            {
                UpdatePosition();
            }


            Game1.spriteBatch.Draw(Game1.mouseCursors,
                                   new Vector2(xPositionOnScreen, yPositionOnScreen),
                                   new Rectangle(16, 368, 16, 16),
                                   Color.White,
                                   0.0f,
                                   Vector2.Zero,
                                   Game1.pixelZoom,
                                   SpriteEffects.None,
                                   1f);

            b.Draw(texture, new Vector2(xPositionOnScreen + 8, yPositionOnScreen + 14), new Rectangle(0, 0, 16, 16), Color.White, 0.0f, Vector2.Zero, 3f, SpriteEffects.None, 1f);

            if (isWithinBounds(Game1.getMouseX(), Game1.getMouseY()))
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.smallFont);
            }
            base.draw(b);
        }
Esempio n. 9
0
        /// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnRenderedActiveMenu(object sender, EventArgs e)
        {
            if (_hoverItem == null &&
                Game1.activeClickableMenu is GameMenu gameMenu &&
                gameMenu.currentTab == 0 &&
                _heldItem == null)
            {
                _showBillboardButton.bounds.X = Game1.activeClickableMenu.xPositionOnScreen + Game1.activeClickableMenu.width - 160;

                _showBillboardButton.bounds.Y = Game1.activeClickableMenu.yPositionOnScreen + Game1.activeClickableMenu.height - 300;
                _showBillboardButton.draw(Game1.spriteBatch);
                if (_showBillboardButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
                {
                    String hoverText = Game1.getMouseX() <
                                       _showBillboardButton.bounds.X + _showBillboardButton.bounds.Width / 2 ?
                                       LanguageKeys.Calendar : LanguageKeys.Billboard;
                    IClickableMenu.drawHoverText(
                        Game1.spriteBatch,
                        ModEntry.Translation.Get(hoverText),
                        Game1.dialogueFont);
                }

                Game1.activeClickableMenu.drawMouse(Game1.spriteBatch);
            }
        }
Esempio n. 10
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * 0.5f);
     this.draw(b, false, false);
     Game1.drawDialogueBox(this.ItemsToGrabMenu.xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder, this.ItemsToGrabMenu.yPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder, this.ItemsToGrabMenu.width + IClickableMenu.borderWidth * 2 + IClickableMenu.spaceToClearSideBorder * 2, this.ItemsToGrabMenu.height + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth * 2, false, true, (string)null, false);
     this.ItemsToGrabMenu.draw(b);
     if (this.poof != null)
     {
         this.poof.draw(b, true, 0, 0);
     }
     if (!this.hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
     }
     if (this.heldItem != null)
     {
         this.heldItem.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + Game1.pixelZoom * 4), (float)(Game1.getOldMouseY() + Game1.pixelZoom * 4)), 1f);
     }
     this.drawMouse(b);
     if (this.ItemsToGrabMenu.descriptionTitle == null || this.ItemsToGrabMenu.descriptionTitle.Length <= 1)
     {
         return;
     }
     IClickableMenu.drawHoverText(b, this.ItemsToGrabMenu.descriptionTitle, Game1.smallFont, Game1.tileSize / 2 + (this.heldItem != null ? Game1.tileSize / 4 : -Game1.tileSize / 3), Game1.tileSize / 2 + (this.heldItem != null ? Game1.tileSize / 4 : -Game1.tileSize / 3), -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
 }
Esempio n. 11
0
 /// <summary>
 /// Draws tooltip on hover
 /// </summary>
 internal void drawHoverTextOverEverything(object sender, EventArgs e)
 {
     if (icon.containsPoint(Game1.oldMouseState.X, Game1.oldMouseState.Y))
     {
         IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont);
     }
 }
Esempio n. 12
0
        public void DrawHoverText()
        {
            Texture2D cursor  = null;
            var       yOffset = 0;
            var       xOffset = 0;

            if (this.hoverTextColor != "")
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, hoverTextColor, Game1.smallFont, 57, -87);
                cursor  = this.cursorColor;
                yOffset = -50;
                xOffset = 32;
            }

            else if (this.hoverTextQuality != "")
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, hoverTextQuality, Game1.smallFont, 57, -87);
                cursor  = this.cursorQuality;
                yOffset = -50;
                xOffset = 32;
            }
            else
            {
                cursor  = Game1.mouseCursors;
                yOffset = 0;
                xOffset = 0;
            }

            // Draws cursor over the GUI element
            Game1.spriteBatch.Draw(cursor, new Vector2(Game1.getOldMouseX() + xOffset, Game1.getOldMouseY() + yOffset),
                                   Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 0, 16, 16), Color.White, 0f, Vector2.Zero,
                                   4f + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 0);
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            if (!this.Config.ShowHUD || Game1.eventUp)
            {
                return;
            }
            if (Constants.TargetPlatform == GamePlatform.Android)
            {
                if (Game1.activeClickableMenu is GameMenu || Game1.activeClickableMenu is ShopMenu || Game1.activeClickableMenu is QuestLog)
                {
                    return;
                }
            }
            if (this.Skills.Count > 0)
            {
                this.DrawSkills(spriteBatch);
            }

            if (this.avatar != null)
            {
                this.DrawAvatar(spriteBatch);
            }

            if (this.Keys.Count > 0)
            {
                this.DrawKeysHelp(spriteBatch);
            }

            if (!string.IsNullOrEmpty(this.hoverText))
            {
                IClickableMenu.drawHoverText(spriteBatch, this.hoverText, Game1.smallFont);
            }
        }
Esempio n. 14
0
        private void drawBirthdayIcon(object sender, EventArgs e)
        {
            if (Game1.eventUp)
            {
                return;
            }

            // Calculate and draw birthday icon
            foreach (GameLocation location in Game1.locations)
            {
                foreach (NPC npc in location.characters)
                {
                    if (npc.isBirthday(Game1.currentSeason, Game1.dayOfMonth))
                    {
                        // draw headshot of npc whos birthday it is
                        Rectangle rect = LocationOfTownsfolk.getHeadShot(npc);

                        int iconPositionX = IconHandler.getIconXPosition();
                        int iconPositionY = 256;

                        float scale = 2.9f;

                        Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(iconPositionX, iconPositionY), new Rectangle(913 / 4, 1638 / 4, 16, 16), Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, 1);
                        var npcMugShot = new ClickableTextureComponent(npc.name, new Rectangle(iconPositionX - 7, iconPositionY - 2, (int)(16 * scale), (int)(16 * scale)), null, npc.name, npc.sprite.Texture, rect, 2f, false);
                        npcMugShot.draw(Game1.spriteBatch);

                        if (npcMugShot.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
                        {
                            string tooltip = $"{npc.name}'s Birthday";
                            IClickableMenu.drawHoverText(Game1.spriteBatch, tooltip, Game1.dialogueFont);
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        public void DrawButtons()
        {
            UpdateButtonPositions();

            buttonColor.texture   = imageColor;
            buttonQuality.texture = imageQuality;

            buttonColor.draw(Game1.spriteBatch, Color.White, 0f, 0);
            buttonQuality.draw(Game1.spriteBatch, Color.White, 0f, 0);

            if (hoverTextColor != "")
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, hoverTextColor, Game1.smallFont);
            }

            if (hoverTextQuality != "")
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, hoverTextQuality, Game1.smallFont);
            }

            // Draws cursor over the GUI element
            Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(Game1.getOldMouseX(), Game1.getOldMouseY()),
                                   Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 0, 16, 16), Color.White, 0f, Vector2.Zero,
                                   4f + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 0);
        }
        public override void draw(SpriteBatch b)
        {
            base.draw(b);

            Game1.spriteBatch.Draw(Game1.mouseCursors,
                                   new Vector2(xPositionOnScreen, yPositionOnScreen),
                                   new Rectangle(16, 368, 16, 16),
                                   Color.White,
                                   0.0f,
                                   Vector2.Zero,
                                   Game1.pixelZoom,
                                   SpriteEffects.None,
                                   0.1f);

            b.Draw(Game1.mouseCursors,
                   new Vector2(xPositionOnScreen + 8, yPositionOnScreen + 14),
                   new Rectangle(32, 672, 16, 16),
                   Color.White,
                   0.0f,
                   Vector2.Zero,
                   3f,
                   SpriteEffects.None,
                   0.1f);


            if (isWithinBounds(Game1.getMouseX(), Game1.getMouseY()))
            {
                string label = ModEntry.Translation.Get("label.ui-mod-options");
                IClickableMenu.drawHoverText(Game1.spriteBatch, label, Game1.smallFont);
            }
            // Tools.DrawMouseCursor();
            Game1.activeClickableMenu.drawMouse(b);
        }
Esempio n. 17
0
 // Token: 0x06000F8F RID: 3983 RVA: 0x0013EC74 File Offset: 0x0013CE74
 public override void draw(SpriteBatch b)
 {
     b.End();
     b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null);
     for (int i = 0; i < this.optionSlots.Count; i++)
     {
         if (this.currentItemIndex >= 0 && this.currentItemIndex + i < this.options.Count)
         {
             this.options[this.currentItemIndex + i].draw(b, this.optionSlots[i].bounds.X, this.optionSlots[i].bounds.Y);
         }
     }
     b.End();
     b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
     if (!GameMenu.forcePreventClose)
     {
         this.upArrow.draw(b);
         this.downArrow.draw(b);
         if (this.options.Count > 7)
         {
             IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), this.scrollBarRunner.X, this.scrollBarRunner.Y, this.scrollBarRunner.Width, this.scrollBarRunner.Height, Color.White, (float)Game1.pixelZoom, false);
             this.scrollBar.draw(b);
         }
     }
     if (!this.hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
     }
 }
Esempio n. 18
0
        private void DrawNPCLocationsOnMap(GameMenu gameMenu)
        {
            List <string> namesToShow = new List <string>();

            foreach (var character in _townsfolk)
            {
                try
                {
                    bool shouldDrawCharacter = Game1.player.friendshipData.ContainsKey(character.Name) && _options.ShowLocationOfFriends.SafeGet(character.Name, true) && character.id != -1;
                    if (shouldDrawCharacter)
                    {
                        DrawNPC(character, namesToShow);
                    }
                }
                catch (Exception ex)
                {
                    ModEntry.MonitorObject.Log(ex.Message + Environment.NewLine + ex.StackTrace, LogLevel.Error);
                }
            }
            DrawNPCNames(namesToShow);

            //The cursor needs to show up in front of the character faces
            Tools.DrawMouseCursor();

            string hoverText = (string)typeof(MapPage)
                               .GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic)
                               .GetValue(gameMenu.pages[gameMenu.currentTab]);

            IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.smallFont);
        }
Esempio n. 19
0
 /// <summary>Draw the menu to the screen.</summary>
 /// <param name="b">The sprite batch being drawn.</param>
 public override void draw(SpriteBatch b)
 {
     if ((this.fadeTimer <= 0 || !this.fadeIntoBlack) && this.state != 3)
     {
         if (this.heldItem != null)
         {
             for (int i = Game1.viewport.Y / Game1.tileSize - 1; i < (Game1.viewport.Y + Game1.viewport.Height) / Game1.tileSize + 2; i++)
             {
                 for (int j = Game1.viewport.X / Game1.tileSize - 1; j < (Game1.viewport.X + Game1.viewport.Width) / Game1.tileSize + 1; j++)
                 {
                     if (((LibraryMuseum)Game1.currentLocation).isTileSuitableForMuseumPiece(j, i))
                     {
                         b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(j, i) * Game1.tileSize), Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 29), Color.LightGreen);
                     }
                 }
             }
         }
         if (!this.HoldingMuseumPiece.GetValue() && this.ShowInventory)
         {
             base.draw(b, false, false);
         }
         if (!this.hoverText.Equals(""))
         {
             IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont);
         }
         this.heldItem?.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 8, Game1.getOldMouseY() + 8), 1f);
         base.drawMouse(b);
         this.sparkleText?.draw(b, Game1.GlobalToLocal(Game1.viewport, this.globalLocationOfSparklingArtifact));
     }
     b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * this.blackFadeAlpha);
 }
Esempio n. 20
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (!this.Config.ShowHUD || Game1.eventUp)
            {
                return;
            }

            if (this.Skills.Count > 0)
            {
                this.DrawSkills(spriteBatch);
            }

            if (this.avatar != null)
            {
                this.DrawAvatar(spriteBatch);
            }

            if (this.Keys.Count > 0)
            {
                this.DrawKeysHelp(spriteBatch);
            }

            if (!string.IsNullOrEmpty(this.hoverText))
            {
                IClickableMenu.drawHoverText(spriteBatch, this.hoverText, Game1.smallFont);
            }
        }
Esempio n. 21
0
 private void OnRenderedHud(object sender, RenderedHudEventArgs e)
 {
     if (_drawQueenOfSauceIcon.Value && !Game1.IsFakedBlackScreen() && (_icon.Value?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
     {
         IClickableMenu.drawHoverText(Game1.spriteBatch, _helper.SafeGetString(LanguageKeys.TodaysRecipe) + _todaysRecipe, Game1.dialogueFont);
     }
 }
Esempio n. 22
0
 public override void draw(SpriteBatch b)
 {
     b.End();
     b.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
     for (int i = 0; i < optionSlots.Count; i++)
     {
         if (currentItemIndex >= 0 && currentItemIndex + i < options.Count)
         {
             options[currentItemIndex + i].draw(b, optionSlots[i].bounds.X, optionSlots[i].bounds.Y, this);
         }
     }
     b.End();
     b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
     if (!GameMenu.forcePreventClose)
     {
         upArrow.draw(b);
         downArrow.draw(b);
         if (options.Count > 7)
         {
             IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), scrollBarRunner.X, scrollBarRunner.Y, scrollBarRunner.Width, scrollBarRunner.Height, Color.White, 4f, drawShadow: false);
             scrollBar.draw(b);
         }
     }
     if (!hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont);
     }
 }
Esempio n. 23
0
        /***
         * Override Methods
         ***/

        public override void draw(SpriteBatch b)
        {
            b.End();
            b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);
            this.headerText.draw(b, this.headerBounds.X, this.headerBounds.Y);

            b.End();
            b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);

            this.searchBox.Draw(b);

            for (int index = 0; index < this.visibleSearchResults.Count; ++index)
            {
                if (this.currentItemIndex >= 0 && this.currentItemIndex + index < this.searchResults.Count)
                {
                    this.searchResults[this.currentItemIndex + index].draw(b, this.visibleSearchResults[index].bounds.X, this.visibleSearchResults[index].bounds.Y);
                }
            }

            if (!GameMenu.forcePreventClose)
            {
                this.upArrow.draw(b);
                this.downArrow.draw(b);
                if (this.searchResults.Count > NUM_ITEMS)
                {
                    IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), this.scrollBarRunner.X, this.scrollBarRunner.Y, this.scrollBarRunner.Width, this.scrollBarRunner.Height, Color.White, (float)Game1.pixelZoom, false);
                    this.scrollBar.draw(b);
                }
            }
            if (this.hoverText.Equals(""))
            {
                return;
            }
            IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
        }
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, Game1.graphics.GraphicsDevice.Viewport.Height), Color.Black * 0.75f);
     Game1.DrawBox(xPositionOnScreen, yPositionOnScreen, width, height);
     okButton.draw(b);
     b.End();
     b.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
     for (int i = 0; i < optionSlots.Count; i++)
     {
         if (currentItemIndex >= 0 && currentItemIndex + i < options.Count)
         {
             options[currentItemIndex + i].draw(b, optionSlots[i].bounds.X, optionSlots[i].bounds.Y, this);
         }
     }
     b.End();
     b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
     if (options.Count > 7)
     {
         upArrow.draw(b);
         downArrow.draw(b);
         IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), scrollBarBounds.X, scrollBarBounds.Y, scrollBarBounds.Width, scrollBarBounds.Height, Color.White, 4f, drawShadow: false);
         scrollBar.draw(b);
     }
     if (!hoverText.Equals(""))
     {
         IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont);
     }
     drawMouse(b);
 }
Esempio n. 25
0
        public override void draw(SpriteBatch b)
        {
            Game1.drawDialogueBox(this.mapX - Game1.pixelZoom * 8, this.mapY - Game1.pixelZoom * 24, (this.map.Bounds.Width + 16) * Game1.pixelZoom, 212 * Game1.pixelZoom, false, true, (string)null, false);
            b.Draw(this.map, new Vector2((float)this.mapX, (float)this.mapY), new Rectangle?(new Rectangle(0, 0, 300, 180)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.86f);
            switch (Game1.whichFarm)
            {
            case 1:
                b.Draw(this.map, new Vector2((float)this.mapX, (float)(this.mapY + 43 * Game1.pixelZoom)), new Rectangle?(new Rectangle(0, 180, 131, 61)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 2:
                b.Draw(this.map, new Vector2((float)this.mapX, (float)(this.mapY + 43 * Game1.pixelZoom)), new Rectangle?(new Rectangle(131, 180, 131, 61)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 3:
                b.Draw(this.map, new Vector2((float)this.mapX, (float)(this.mapY + 43 * Game1.pixelZoom)), new Rectangle?(new Rectangle(0, 241, 131, 61)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 4:
                b.Draw(this.map, new Vector2((float)this.mapX, (float)(this.mapY + 43 * Game1.pixelZoom)), new Rectangle?(new Rectangle(131, 241, 131, 61)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;
            }
            Game1.player.FarmerRenderer.drawMiniPortrat(b, this.playerMapPosition - new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), 0.00011f, 4f, 2, Game1.player);
            if (this.playerLocationName != null)
            {
                SpriteText.drawStringWithScrollCenteredAt(b, this.playerLocationName, this.xPositionOnScreen + this.width / 2, this.yPositionOnScreen + this.height + Game1.tileSize / 2 + Game1.pixelZoom * 4, "", 1f, -1, 0, 0.88f, false);
            }
            this.okButton.draw(b);
            if (this.hoverText.Equals(""))
            {
                return;
            }
            IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
        }
Esempio n. 26
0
        //private OptionComponent tester = new SliderComponent("Hey", 0, 10, 1, 5, true);

        public override void draw(SpriteBatch b)
        {
            //base.draw(b);
            //tester.draw(b);
            if (!(Game1.activeClickableMenu is GameMenu))
            {
                return;
            }                                                                     // must be main menu
            if ((Game1.activeClickableMenu as GameMenu).currentTab != ModSettings.pageIndex)
            {
                return;
            }                                                                                                        //must be mod tab



            Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, null, false);

            base.drawHorizontalPartition(b, (int)(this.yPositionOnScreen + Game1.pixelZoom * 40));

            if (Sheets.Count > 0)
            {
                Sheets[modSelected.SelectionIndex].draw(b);
            }

            // draw mod select dropdown last, should cover mod settings
            modSelected.draw(b);
            SpriteText.drawString(b, "Mod Options", modSelected.X + modSelected.Width + Game1.pixelZoom * 5, modSelected.Y);

            if (Sheets.Count > 0 && (Game1.getMouseX() > this.modSelected.X && Game1.getMouseX() < this.modSelected.X + this.modSelected.Width) && (Game1.getMouseY() > this.modSelected.Y && Game1.getMouseY() < this.modSelected.Y + this.modSelected.Height) && !modSelected.IsActiveComponent())
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, Utilities.GetWordWrappedString(this.controller.ModOptionsList[modSelected.SelectionIndex].modManifest.Description), Game1.smallFont);
            }
        }
Esempio n. 27
0
        public override void draw(SpriteBatch b)
        {
            base.draw(b);
            Game1.spriteBatch.Draw(Game1.mouseCursors,
                                   new Vector2(xPositionOnScreen, yPositionOnScreen),
                                   new Rectangle(16, 368, 16, 16),
                                   Color.White,
                                   0.0f,
                                   Vector2.Zero,
                                   Game1.pixelZoom,
                                   SpriteEffects.None,
                                   1f);

            b.Draw(Game1.mouseCursors,
                   new Vector2(xPositionOnScreen + 8, yPositionOnScreen + 14),
                   new Rectangle(32, 672, 16, 16),
                   Color.White,
                   0.0f,
                   Vector2.Zero,
                   3f,
                   SpriteEffects.None,
                   1f);

            if (isWithinBounds(Game1.getMouseX(), Game1.getMouseY()))
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, "UI Info Mod Options", Game1.smallFont);
            }
            drawMouse(b);
        }
Esempio n. 28
0
        /// <summary>
        /// Draws the tab in the top right corner of the GameMenu
        /// </summary>
        private void drawButton(object sender, EventArgs e)
        {
            if (!(Game1.activeClickableMenu is GameMenu) || optionPageButton == null)
            {
                return;
            }

            // Don't draw when map is displayed
            var gameMenu = ( GameMenu )Game1.activeClickableMenu;

            if (gameMenu.currentTab == GameMenu.mapTab)
            {
                return;
            }

            optionPageButton.draw(Game1.spriteBatch);

            string hoverText = ModEntry.helper.Reflection.GetPrivateField <string>(Game1.activeClickableMenu, "hoverText").GetValue();

            // Redraw hover text so that it overlaps icon
            if (hoverText == "Exit Game")
            {
                IClickableMenu.drawHoverText(Game1.spriteBatch, "Exit Game", Game1.smallFont);
            }
        }
Esempio n. 29
0
        /// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnRenderingHud(object sender, RenderingHudEventArgs e)
        {
            // draw icon
            if (!Game1.eventUp)
            {
                if (_drawQueenOfSauceIcon)
                {
                    Point iconPosition = IconHandler.Handler.GetNewIconPosition();

                    _queenOfSauceIcon = new ClickableTextureComponent(
                        new Rectangle(iconPosition.X, iconPosition.Y, 40, 40),
                        Game1.mouseCursors,
                        new Rectangle(609, 361, 28, 28),
                        1.3f);
                    _queenOfSauceIcon.draw(Game1.spriteBatch);
                }

                if (_drawDishOfDayIcon)
                {
                    Point iconLocation = IconHandler.Handler.GetNewIconPosition();
                    float scale        = 2.9f;

                    Game1.spriteBatch.Draw(
                        Game1.objectSpriteSheet,
                        new Vector2(iconLocation.X, iconLocation.Y),
                        new Rectangle(306, 291, 14, 14),
                        Color.White,
                        0,
                        Vector2.Zero,
                        scale,
                        SpriteEffects.None,
                        1f);

                    ClickableTextureComponent texture =
                        new ClickableTextureComponent(
                            _gus.Name,
                            new Rectangle(
                                iconLocation.X - 7,
                                iconLocation.Y - 2,
                                (int)(16.0 * scale),
                                (int)(16.0 * scale)),
                            null,
                            _gus.Name,
                            _gus.Sprite.Texture,
                            _gus.GetHeadShot(),
                            2f);

                    texture.draw(Game1.spriteBatch);

                    if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
                    {
                        IClickableMenu.drawHoverText(
                            Game1.spriteBatch,
                            "Gus is selling " + Game1.dishOfTheDay.DisplayName + " recipe today!",
                            Game1.dialogueFont);
                    }
                }
            }
        }
Esempio n. 30
0
        public override void draw(SpriteBatch b)
        {
            float scroll_draw_y      = yPositionOnScreen + height + 32 + 16;
            float scroll_draw_bottom = scroll_draw_y + 80f;

            if (scroll_draw_bottom > (float)Game1.viewport.Height)
            {
                scroll_draw_y -= scroll_draw_bottom - (float)Game1.viewport.Height;
            }
            int boxY = mapY - 96;
            int mY   = mapY;

            Game1.drawDialogueBox(mapX - 32, boxY, (map.Bounds.Width + 16) * 4, 848, speaker: false, drawOnlyBox: true);
            b.Draw(map, new Vector2(mapX, mY), new Rectangle(0, 0, 300, 180), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.86f);
            switch (Game1.whichFarm)
            {
            case 1:
                b.Draw(map, new Vector2(mapX, mY + 172), new Rectangle(0, 180, 131, 61), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 2:
                b.Draw(map, new Vector2(mapX, mY + 172), new Rectangle(131, 180, 131, 61), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 3:
                b.Draw(map, new Vector2(mapX, mY + 172), new Rectangle(0, 241, 131, 61), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 4:
                b.Draw(map, new Vector2(mapX, mY + 172), new Rectangle(131, 241, 131, 61), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;

            case 5:
                b.Draw(map, new Vector2(mapX, mY + 172), new Rectangle(0, 302, 131, 61), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
                break;
            }
            if (drawPamHouseUpgrade)
            {
                b.Draw(map, new Vector2(mapX + 780, mapY + 348), new Rectangle(263, 181, 8, 8), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
            }
            if (drawMovieTheater)
            {
                b.Draw(map, new Vector2(mapX + 852, mapY + 280), new Rectangle(271, 181, 29, 13), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
            }
            if (drawMovieTheaterJoja)
            {
                b.Draw(map, new Vector2(mapX + 684, mapY + 192), new Rectangle(276, 181, 13, 13), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.861f);
            }
            drawMiniPortraits(b);
            if (playerLocationName != null)
            {
                SpriteText.drawStringWithScrollCenteredAt(b, playerLocationName, xPositionOnScreen + width / 2, (int)scroll_draw_y);
            }
            okButton.draw(b);
            if (!hoverText.Equals(""))
            {
                IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont);
            }
        }