From 5e14cc355fd3a4a27a0196f504fee16d68f39612 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Wed, 02 Apr 2025 17:25:03 +0000
Subject: [PATCH] #41 fixed item description text

---
 Assets/Scripts/Helpers/VectorHelper.cs   |    9 +++++++++
 Assets/Scripts/Inventory/ItemUIScript.cs |    6 ++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Assets/Scripts/Helpers/VectorHelper.cs b/Assets/Scripts/Helpers/VectorHelper.cs
index 75b92d0..9550984 100644
--- a/Assets/Scripts/Helpers/VectorHelper.cs
+++ b/Assets/Scripts/Helpers/VectorHelper.cs
@@ -138,5 +138,14 @@
             }
             return result;
         }
+
+        public static string ToRangeString(this Vector2 vector)
+        {
+            if (vector.x == vector.y)
+            {
+                return $"{vector.x}";
+            }
+            return $"{vector.x}-{vector.y}";
+        }
     }
 }
\ No newline at end of file
diff --git a/Assets/Scripts/Inventory/ItemUIScript.cs b/Assets/Scripts/Inventory/ItemUIScript.cs
index 4f9f49b..a4ad058 100644
--- a/Assets/Scripts/Inventory/ItemUIScript.cs
+++ b/Assets/Scripts/Inventory/ItemUIScript.cs
@@ -42,10 +42,8 @@
                         description += $"\n<b>Generation</b>";
                         foreach (var variant in variants)
                         {
-                            if (variant.maxHeight > 0 || variant.minHeight > 0)
-                            {
-                                description += $"\nSpawns between Y: {variant.minHeight} - {variant.maxHeight}. Amount: {variant.dropRange}";
-                            }
+                            description += $"\nLocation\tY: {variant.maxHeight} to {variant.minHeight}";
+                            description += $"\n\tAmount: {variant.dropRange.ToRangeString()}";
                         }
                     }
                     gameObject.transform.Find("ItemTextDescription").GetComponent<TextMeshProUGUI>().text = description;

--
Gitblit v1.9.3