public sealed override void draw(SpriteBatch b) { try { DrawBox(b, xPositionOnScreen, yPositionOnScreen, width, height); int SeparatorHeight = 24; DrawHorizontalSeparator(b, xPositionOnScreen, InventoryMenu.TopLeftScreenPosition.Y - InventoryMargin - SeparatorHeight / 2, width, SeparatorHeight); InventoryMenu.Draw(b); if (IsLeftSidebarVisible || IsRightSidebarVisible) { if (IsLeftSidebarVisible) { // Draw the deposit/withdraw-all buttons Rectangle ArrowUpIconSourceRect = new Rectangle(421, 459, 12, 12); Rectangle ArrowDownIconSourceRect = new Rectangle(421, 472, 12, 12); int ArrowSize = (int)(ArrowUpIconSourceRect.Width * 1.5 / 32.0 * DepositAllBounds.Width); b.Draw(Game1.menuTexture, DepositAllBounds, new Rectangle(128, 128, 64, 64), Color.White); b.Draw(Game1.mouseCursors, new Rectangle(DepositAllBounds.X + (DepositAllBounds.Width - ArrowSize) / 2, DepositAllBounds.Y + (DepositAllBounds.Height - ArrowSize) / 2, ArrowSize, ArrowSize), ArrowUpIconSourceRect, Color.White); b.Draw(Game1.menuTexture, WithdrawAllBounds, new Rectangle(128, 128, 64, 64), Color.White); b.Draw(Game1.mouseCursors, new Rectangle(WithdrawAllBounds.X + (WithdrawAllBounds.Width - ArrowSize) / 2, WithdrawAllBounds.Y + (WithdrawAllBounds.Height - ArrowSize) / 2, ArrowSize, ArrowSize), ArrowDownIconSourceRect, Color.White); // Draw the autofill togglebutton Rectangle HandIconSourceRect = new Rectangle(32, 0, 10, 10); int HandIconSize = (int)(HandIconSourceRect.Width * 2.0 / 32.0 * AutolootBounds.Width); b.Draw(Game1.menuTexture, AutolootBounds, new Rectangle(128, 128, 64, 64), Color.White); b.Draw(Game1.mouseCursors, new Rectangle(AutolootBounds.X + (AutolootBounds.Width - HandIconSize) / 2, AutolootBounds.Y + (AutolootBounds.Height - HandIconSize) / 2, HandIconSize, HandIconSize), HandIconSourceRect, Color.White); if (Bag is BoundedBag BB) { if (!BB.Autofill) { Rectangle DisabledIconSourceRect = new Rectangle(322, 498, 12, 12); int DisabledIconSize = (int)(DisabledIconSourceRect.Width * 1.5 / 32.0 * AutolootBounds.Width); Rectangle Destination = new Rectangle(AutolootBounds.Right - DisabledIconSize - 2, AutolootBounds.Bottom - DisabledIconSize - 2, DisabledIconSize, DisabledIconSize); b.Draw(Game1.mouseCursors, Destination, DisabledIconSourceRect, Color.White); } } else if (Bag is Rucksack RS) { if (!RS.Autofill) { Rectangle DisabledIconSourceRect = new Rectangle(322, 498, 12, 12); int DisabledIconSize = (int)(DisabledIconSourceRect.Width * 1.5 / 32.0 * AutolootBounds.Width); Rectangle Destination = new Rectangle(AutolootBounds.Right - DisabledIconSize - 2, AutolootBounds.Bottom - DisabledIconSize - 2, DisabledIconSize, DisabledIconSize); b.Draw(Game1.mouseCursors, Destination, DisabledIconSourceRect, Color.White); } else { if (RS.AutofillPriority == AutofillPriority.Low) { Rectangle LowPriorityIconSourceRect = new Rectangle(421, 472, 12, 12); int LowPriorityIconSize = (int)(LowPriorityIconSourceRect.Width * 1.0 / 32.0 * AutolootBounds.Width); Rectangle Destination = new Rectangle(AutolootBounds.Right - LowPriorityIconSize - 2, AutolootBounds.Bottom - LowPriorityIconSize - 2, LowPriorityIconSize, LowPriorityIconSize); b.Draw(Game1.mouseCursors, Destination, LowPriorityIconSourceRect, Color.White); } else if (RS.AutofillPriority == AutofillPriority.High) { Rectangle HighPriorityIconSourceRect = new Rectangle(421, 459, 12, 12); int HighPriorityIconSize = (int)(HighPriorityIconSourceRect.Width * 1.0 / 32.0 * AutolootBounds.Width); Rectangle Destination = new Rectangle(AutolootBounds.Right - HighPriorityIconSize - 2, AutolootBounds.Bottom - HighPriorityIconSize - 2, HighPriorityIconSize, HighPriorityIconSize); b.Draw(Game1.mouseCursors, Destination, HighPriorityIconSourceRect, Color.White); } } } } if (IsRightSidebarVisible) { // Draw the help button Rectangle HelpIconSourceRect = new Rectangle(176, 425, 9, 12); int HelpIconWidth = (int)(HelpIconSourceRect.Width * 1.5 / 32.0 * HelpInfoBounds.Width); int HelpIconHeight = (int)(HelpIconSourceRect.Height * 1.5 / 32.0 * HelpInfoBounds.Height); b.Draw(Game1.menuTexture, HelpInfoBounds, new Rectangle(128, 128, 64, 64), Color.White); b.Draw(Game1.mouseCursors, new Rectangle(HelpInfoBounds.X + (HelpInfoBounds.Width - HelpIconWidth) / 2, HelpInfoBounds.Y + (HelpInfoBounds.Height - HelpIconHeight) / 2, HelpIconWidth, HelpIconHeight), HelpIconSourceRect, Color.White); if (Bag.CanCustomizeIcon()) { // Draw the customize icon button Rectangle CustomizeSourceRect = new Rectangle(121, 471, 12, 12); int CustomizeIconWidth = CustomizeIconBounds.Width; int CustomizeIconHeight = CustomizeIconBounds.Height; b.Draw(Game1.mouseCursors, new Rectangle(CustomizeIconBounds.X + (CustomizeIconBounds.Width - CustomizeIconWidth) / 2, CustomizeIconBounds.Y + (CustomizeIconBounds.Height - CustomizeIconHeight) / 2, CustomizeIconWidth, CustomizeIconHeight), CustomizeSourceRect, Color.White); b.Draw(Game1.menuTexture, CustomizeIconBounds, new Rectangle(128, 128, 64, 64), Color.White); } } // Draw a yellow border around the hovered sidebar button if (HoveredButton.HasValue) { Rectangle HoveredBounds = HoveredButtonBounds.Value; Color HighlightColor = Color.Yellow; Texture2D Highlight = TextureHelpers.GetSolidColorTexture(Game1.graphics.GraphicsDevice, HighlightColor); b.Draw(Highlight, HoveredBounds, Color.White * 0.25f); int BorderThickness = HoveredBounds.Width / 16; DrawBorder(b, HoveredBounds, BorderThickness, HighlightColor); } } Content.Draw(b); if (IsShowingModalMenu && CustomizeIconMenu != null) { CustomizeIconMenu.Draw(b); } else { InventoryMenu.DrawToolTips(b); Content.DrawToolTips(b); // Draw tooltips on the sidebar buttons if ((IsLeftSidebarVisible || IsRightSidebarVisible) && HoveredButton.HasValue) { if (IsLeftSidebarVisible) { string ButtonToolTip = ""; if (HoveredButton.Value == SidebarButton.DepositAll) { ButtonToolTip = ItemBagsMod.Translate("DepositAllToolTip"); } else if (HoveredButton.Value == SidebarButton.WithdrawAll) { ButtonToolTip = ItemBagsMod.Translate("WithdrawAllToolTip"); } else if (HoveredButton.Value == SidebarButton.Autoloot) { if (Bag is BoundedBag BB) { ButtonToolTip = ItemBagsMod.Translate(BB.Autofill ? "AutofillOnToolTip" : "AutofillOffToolTip"); } else if (Bag is Rucksack RS) { string TranslationKey; if (RS.Autofill) { if (RS.AutofillPriority == AutofillPriority.Low) { TranslationKey = "RucksackAutofillLowPriorityToolTip"; } else if (RS.AutofillPriority == AutofillPriority.High) { TranslationKey = "RucksackAutofillHighPriorityToolTip"; } else { throw new NotImplementedException(string.Format("Unrecognized Rucksack AutofillPriority: {0}", RS.AutofillPriority.ToString())); } } else { TranslationKey = "RucksackAutofillOffToolTip"; } ButtonToolTip = ItemBagsMod.Translate(TranslationKey); } } if (!string.IsNullOrEmpty(ButtonToolTip)) { int Margin = 16; Vector2 ToolTipSize = Game1.smallFont.MeasureString(ButtonToolTip); DrawBox(b, HoveredButtonBounds.Value.Right, HoveredButtonBounds.Value.Top, (int)(ToolTipSize.X + Margin * 2), (int)(ToolTipSize.Y + Margin * 2)); b.DrawString(Game1.smallFont, ButtonToolTip, new Vector2(HoveredButtonBounds.Value.Right + Margin, HoveredButtonBounds.Value.Top + Margin), Color.Black); } } if (IsRightSidebarVisible) { string ButtonToolTip = ""; if (HoveredButton.Value == SidebarButton.HelpInfo) { ButtonToolTip = ItemBagsMod.Translate("HelpInfoToolTip"); } else if (HoveredButton.Value == SidebarButton.CustomizeIcon) { ButtonToolTip = ItemBagsMod.Translate("CustomizeIconToolTip"); } if (!string.IsNullOrEmpty(ButtonToolTip)) { int Margin = 16; Vector2 ToolTipSize = Game1.smallFont.MeasureString(ButtonToolTip); DrawBox(b, HoveredButtonBounds.Value.Left - (int)(ToolTipSize.X + Margin * 2), HoveredButtonBounds.Value.Top, (int)(ToolTipSize.X + Margin * 2), (int)(ToolTipSize.Y + Margin * 2)); b.DrawString(Game1.smallFont, ButtonToolTip, new Vector2(HoveredButtonBounds.Value.Left - Margin - ToolTipSize.X, HoveredButtonBounds.Value.Top + Margin), Color.Black); } } } } upperRightCloseButton.draw(b); if (!Game1.options.hardwareCursor && !Game1.options.gamepadControls) { drawMouse(b); } } catch (Exception ex) { ItemBagsMod.ModInstance.Monitor.Log(string.Format("Unhandled error in ItemBagMenu.Draw: {0}", ex.Message), LogLevel.Error); } }