From 1f46626c1d98f37b1fdb65abf6f4dea271494689 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Tue, 01 Apr 2025 15:53:40 +0000
Subject: [PATCH] fixed ruletileset

---
 Assets/Scripts/Helpers/TextMeshProHelper.cs |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/Assets/Scripts/Helpers/TextMeshProHelper.cs b/Assets/Scripts/Helpers/TextMeshProHelper.cs
new file mode 100644
index 0000000..eb3b921
--- /dev/null
+++ b/Assets/Scripts/Helpers/TextMeshProHelper.cs
@@ -0,0 +1,40 @@
+using Assets.Scripts.Enums;
+using System;
+using System.Reflection;
+using TMPro;
+using UnityEngine;
+
+namespace Assets.Scripts.Helpers
+{
+    internal static class TextMeshProHelper
+    {
+
+        /// <summary>
+        /// Will get the string value for a given enums value, this will
+        /// only work if you assign the StringValue attribute to
+        /// the items in your enum.
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static void UpdateItemMaxCountText(TextMeshProUGUI inventoryText, int itemCount, int maxCount)
+        {
+            float fillPercentage = (float)itemCount / maxCount * 100;
+
+            // Set color based on fill percentage
+            if (fillPercentage >= 100)
+            {
+                inventoryText.color = Color.red;
+            }
+            else if (fillPercentage >= 50)
+            {
+                inventoryText.color = Color.yellow;
+            }
+            else
+            {
+                inventoryText.color = Color.green;
+            }
+
+            inventoryText.text = $"{itemCount} ({maxCount})";
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3