From fe421e1b91bbb3f69e494ec58dd8092d61346f5e Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 05 九月 2025 15:25:31 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/Utility/UIHelper.cs |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 6e47226..84dc837 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -761,6 +761,30 @@
         return msg;
     }
 
+    public static string AppendColor(Color color, string msg)
+    { 
+        return StringUtility.Contact("<color=#", ColorToHexWithHash(color), ">", msg, "</color>");
+    }
+
+
+    public static string ColorToHexWithHash(Color color, bool includeAlpha = false)
+    {
+        int r = Mathf.RoundToInt(color.r * 255);
+        int g = Mathf.RoundToInt(color.g * 255);
+        int b = Mathf.RoundToInt(color.b * 255);
+        if (includeAlpha)
+        {
+            int a = Mathf.RoundToInt(color.a * 255);
+            return string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", r, g, b, a);
+        }
+        else
+        {
+            return string.Format("{0:X2}{1:X2}{2:X2}", r, g, b);
+        }
+    }
+
+
+
     //needName 鎸囧畼鑱�0鏄惁闇�瑕佸悕绉�
     public static string GetRealmName(int realmLv, bool bright = true, bool needName = false)
     {
@@ -825,7 +849,7 @@
     /// <param name="itemColor"></param>
     /// <param name="msg"></param>
     /// <param name="bright"></param>
-    /// <param name="colorGroupType"></param>
+    /// <param name="colorGroupType">0 閫氱敤鍔熻兘鍝佽川鍒嗙粍绮捐壇鍒扮璇�</param>
     /// <returns></returns>
     public static string AppendColor(int itemColor, string msg, bool bright = true, int colorGroupType = 0)
     {

--
Gitblit v1.8.0