public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); for (int i = 0; i < _categoryButtons.Count; i++) { if (_categoryButtons[i].IsMouseHovering) { string text; switch (i) { case 0: text = sortMode.ToFriendlyString(); break; case 1: text = enabledFilterMode.ToFriendlyString(); break; case 2: text = modSideFilterMode.ToFriendlyString(); break; case 3: text = searchFilterMode.ToFriendlyString(); break; default: text = "None"; break; } UICommon.DrawHoverStringInBounds(spriteBatch, text); return; } } UILinkPointNavigator.Shortcuts.BackButtonCommand = 1; }
public override void Draw(SpriteBatch spriteBatch) { tooltip = null; base.Draw(spriteBatch); for (int i = 0; i < _categoryButtons.Count; i++) { if (_categoryButtons[i].IsMouseHovering) { string text; switch (i) { case 0: text = sortMode.ToFriendlyString(); break; case 1: text = enabledFilterMode.ToFriendlyString(); break; case 2: text = modSideFilterMode.ToFriendlyString(); break; case 3: text = searchFilterMode.ToFriendlyString(); break; default: text = "None"; break; } UICommon.DrawHoverStringInBounds(spriteBatch, text); return; } } if (!string.IsNullOrEmpty(tooltip)) { Rectangle bounds = GetDimensions().ToRectangle(); Vector2 stringDimensions = Main.fontMouseText.MeasureString(tooltip); Vector2 vector = Main.MouseScreen + new Vector2(16f); vector.X = System.Math.Min(vector.X, bounds.Right - stringDimensions.X - 16); vector.Y = System.Math.Min(vector.Y, bounds.Bottom - 30); Rectangle drawDestination = new Rectangle((int)vector.X, (int)vector.Y, (int)stringDimensions.X, (int)stringDimensions.Y); Rectangle backgroundDrawDestination = drawDestination; backgroundDrawDestination.Inflate(12, 12); Utils.DrawInvBG(spriteBatch, backgroundDrawDestination); Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, tooltip, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f); } UILinkPointNavigator.Shortcuts.BackButtonCommand = 1; }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); for (int i = 0; i < this._categoryButtons.Count; i++) { if (this._categoryButtons[i].IsMouseHovering) { string text; switch (i) { case 0: text = sortMode.ToFriendlyString(); break; case 1: text = enabledFilterMode.ToFriendlyString(); break; case 2: text = modSideFilterMode.ToFriendlyString(); break; case 3: text = searchFilterMode.ToFriendlyString(); break; default: text = "None"; break; } //TODO common pattern float x = Main.fontMouseText.MeasureString(text).X; Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f); if (vector.Y > (float)(Main.screenHeight - 30)) { vector.Y = (float)(Main.screenHeight - 30); } if (vector.X > (float)Main.screenWidth - x) { vector.X = (float)(Main.screenWidth - x - 30); } Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, text, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f); return; } } UILinkPointNavigator.Shortcuts.BackButtonCommand = 1; }