From 22f891ab9ea55c3307328981672e654f9fd3e697 Mon Sep 17 00:00:00 2001 From: Moonwolf287 Date: Sun, 8 Dec 2019 16:48:55 +0100 Subject: [PATCH 1/3] Fixed Alignment of Bundle Hover Info - moved background down to suround the text - moved Icon up to be next to text & not overlap with gold price in tooltip --- SDVModTest/UIElements/ShowItemHoverInformation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDVModTest/UIElements/ShowItemHoverInformation.cs b/SDVModTest/UIElements/ShowItemHoverInformation.cs index d18ab75a..f3440b8b 100644 --- a/SDVModTest/UIElements/ShowItemHoverInformation.cs +++ b/SDVModTest/UIElements/ShowItemHoverInformation.cs @@ -372,7 +372,7 @@ private void DrawAdvancedTooltip() int num1 = (int)windowPos.X - 30; int num2 = (int)windowPos.Y - 10; int num3 = num1 + 52; - int y3 = num2 - 2; + int y3 = num2 + 2; int num4 = 288; int height = 36; int num5 = 36; @@ -395,7 +395,7 @@ private void DrawAdvancedTooltip() Color.White); _bundleIcon.bounds.X = num1 + 16; - _bundleIcon.bounds.Y = num2; + _bundleIcon.bounds.Y = num2 - 10; _bundleIcon.scale = 3; _bundleIcon.draw(Game1.spriteBatch); } From 612aecd1b2d5ad3f470fc5f01beebd2fd16387cc Mon Sep 17 00:00:00 2001 From: Moonwolf287 Date: Wed, 11 Dec 2019 13:59:37 +0100 Subject: [PATCH 2/3] Using bundleTextWidth to determine width of Tooltip & minor bundle text alignment --- .../UIElements/ShowItemHoverInformation.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/SDVModTest/UIElements/ShowItemHoverInformation.cs b/SDVModTest/UIElements/ShowItemHoverInformation.cs index f3440b8b..8b97c9c8 100644 --- a/SDVModTest/UIElements/ShowItemHoverInformation.cs +++ b/SDVModTest/UIElements/ShowItemHoverInformation.cs @@ -208,11 +208,17 @@ private void DrawAdvancedTooltip() } } - int largestTextWidth = 0; - int stackTextWidth = (int)(Game1.smallFont.MeasureString(stackPrice.ToString()).Length()); + + int bundleTextWidth = 0; + if (!String.IsNullOrEmpty(requiredBundleName)) + { + bundleTextWidth = (int)Game1.dialogueFont.MeasureString(requiredBundleName).Length(); + bundleTextWidth -= 30; //Text offset from left + } + int stackTextWidth = (int)(Game1.smallFont.MeasureString(stackPrice.ToString()).Length()); int itemTextWidth = (int)(Game1.smallFont.MeasureString(itemPrice.ToString()).Length()); - largestTextWidth = (stackTextWidth > itemTextWidth) ? stackTextWidth : itemTextWidth; - int windowWidth = Math.Max(largestTextWidth + 90, String.IsNullOrEmpty(requiredBundleName) ? 100 : 300); + int largestTextWidth = Math.Max(bundleTextWidth,Math.Max(stackTextWidth, itemTextWidth)); + int windowWidth = largestTextWidth + 90; int windowHeight = 75; @@ -370,16 +376,15 @@ private void DrawAdvancedTooltip() if (!String.IsNullOrEmpty(requiredBundleName)) { int num1 = (int)windowPos.X - 30; - int num2 = (int)windowPos.Y - 10; + int num2 = (int)windowPos.Y - 14; int num3 = num1 + 52; - int y3 = num2 + 2; - int num4 = 288; + int y3 = num2 + 4; int height = 36; int num5 = 36; - int width = num4 / num5; + int width = (bundleTextWidth+90) / num5; int num6 = 6; - for (int i = 0; i < 36; ++i) + for (int i = 0; i < num5; ++i) { float num7 = (float)(i >= num6 ? 0.92 - (i - num6) * (1.0 / (num5 - num6)) : 0.92f); Game1.spriteBatch.Draw( @@ -387,7 +392,7 @@ private void DrawAdvancedTooltip() new Rectangle(num3 + width * i, y3, width, height), Color.Crimson * num7); } - + Game1.spriteBatch.DrawString( Game1.dialogueFont, requiredBundleName, @@ -395,7 +400,7 @@ private void DrawAdvancedTooltip() Color.White); _bundleIcon.bounds.X = num1 + 16; - _bundleIcon.bounds.Y = num2 - 10; + _bundleIcon.bounds.Y = num2 - 6; _bundleIcon.scale = 3; _bundleIcon.draw(Game1.spriteBatch); } From 81034ad2a976b81f4552891d549b76c1afd6590c Mon Sep 17 00:00:00 2001 From: Moonwolf287 Date: Sat, 28 Dec 2019 23:48:49 +0100 Subject: [PATCH 3/3] Changed from tabs to space --- SDVModTest/UIElements/ShowItemHoverInformation.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SDVModTest/UIElements/ShowItemHoverInformation.cs b/SDVModTest/UIElements/ShowItemHoverInformation.cs index 8b97c9c8..10dbf0da 100644 --- a/SDVModTest/UIElements/ShowItemHoverInformation.cs +++ b/SDVModTest/UIElements/ShowItemHoverInformation.cs @@ -212,13 +212,13 @@ private void DrawAdvancedTooltip() int bundleTextWidth = 0; if (!String.IsNullOrEmpty(requiredBundleName)) { - bundleTextWidth = (int)Game1.dialogueFont.MeasureString(requiredBundleName).Length(); - bundleTextWidth -= 30; //Text offset from left + bundleTextWidth = (int)Game1.dialogueFont.MeasureString(requiredBundleName).Length(); + bundleTextWidth -= 30; //Text offset from left } - int stackTextWidth = (int)(Game1.smallFont.MeasureString(stackPrice.ToString()).Length()); + int stackTextWidth = (int)(Game1.smallFont.MeasureString(stackPrice.ToString()).Length()); int itemTextWidth = (int)(Game1.smallFont.MeasureString(itemPrice.ToString()).Length()); - int largestTextWidth = Math.Max(bundleTextWidth,Math.Max(stackTextWidth, itemTextWidth)); - int windowWidth = largestTextWidth + 90; + int largestTextWidth = Math.Max(bundleTextWidth,Math.Max(stackTextWidth, itemTextWidth)); + int windowWidth = largestTextWidth + 90; int windowHeight = 75; @@ -392,7 +392,7 @@ private void DrawAdvancedTooltip() new Rectangle(num3 + width * i, y3, width, height), Color.Crimson * num7); } - + Game1.spriteBatch.DrawString( Game1.dialogueFont, requiredBundleName,