From 3bd7f56906e31e8fe0072108c9d4652707b51de8 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 21 十月 2025 17:59:00 +0800
Subject: [PATCH] 125 战斗 战斗UI

---
 Main/Utility/UIHelper.cs |   97 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 84 insertions(+), 13 deletions(-)

diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 84dc837..8c204df 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -69,14 +69,15 @@
     public static void SetIconWithMoneyType(this Image _image, int moneyType)
     {
         if (_image == null) return;
-        // string iconKey = StringUtility.Contact("Money_Type_", moneyType);
         if (GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType))
         {
             _image.SetOrgSprite(ItemConfig.Get(GeneralDefine.MoneyDisplayModel[moneyType]).IconKey);
         }
         else
-        { 
-            Debug.LogError("MoneyDisplayModel 涓洪厤缃揣甯佺被鍨嬶細" + moneyType);
+        {
+            // 涓嶉渶瑕佺墿鍝佺殑鎯呭喌琛ュ厖
+            // string iconKey = StringUtility.Contact("Money_Type_", moneyType);
+            Debug.LogError("MoneyDisplayModel 鏈厤缃揣甯佺被鍨嬶細" + moneyType);
         }
     }
 
@@ -88,7 +89,7 @@
         }
         else
         {
-            Debug.LogError("MoneyDisplayModel 涓洪厤缃揣甯佺被鍨嬶細" + moneyType);
+            Debug.LogError("MoneyDisplayModel 鏈厤缃揣甯佺被鍨嬶細" + moneyType);
             return "";
         }
     }
@@ -323,6 +324,13 @@
         }
         return false;
     }
+
+    // 妫�鏌ュ瓧绗︿覆鏄笉鏄函鏁存暟
+    public static bool IsNumeric(string input)
+    {
+        return int.TryParse(input, out _);
+    }
+
 
     public static string GetColorNameByItemColor(int itemColor)
     {
@@ -676,7 +684,7 @@
                 // 5d1d52 姘告亽
                 return new Color32(93, 29, 82, 128);
             case QualityTextColType.red:
-                return s_BrightRedColor;
+                return s_DarkRedColor;
         }
         return new Color32(0, 0, 0, 128);
     }
@@ -753,7 +761,7 @@
                 return StringUtility.Contact("<color=#dfbbed>", msg, "</color>");
             case TextColType.itembuxiu:
                 // 5eeff2 涓嶆溄
-                return  StringUtility.Contact("<color=#5eeff2>", msg, "</color>");
+                return StringUtility.Contact("<color=#5eeff2>", msg, "</color>");
             case TextColType.itemyonghen:
                 // f5b4ea 姘告亽
                 return StringUtility.Contact("<color=#f5b4ea>", msg, "</color>");
@@ -762,7 +770,7 @@
     }
 
     public static string AppendColor(Color color, string msg)
-    { 
+    {
         return StringUtility.Contact("<color=#", ColorToHexWithHash(color), ">", msg, "</color>");
     }
 
@@ -927,7 +935,7 @@
     }
     #endregion
 
-    
+
 
     #region 寰楀埌閲戦挶鏁伴噺鏍规嵁閲戦挶绫诲瀷
 
@@ -968,7 +976,7 @@
         {3, PlayerDataType.Silver},
         {41, PlayerDataType.default26},
         {42, PlayerDataType.default33},
-
+        {53, PlayerDataType.ChallengeVoucher},
     };
 
     public static long GetMoneyCnt(int moneyType)
@@ -1105,6 +1113,16 @@
                     //姝﹀皢鎷涘嫙绉垎
                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default44);
                 }
+            case 52:
+                {
+                    //娣橀噾浠�
+                    return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.GoldRush);
+                }
+            case 53:
+                {
+                    //鎸戞垬鍑瘉
+                    return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ChallengeVoucher);
+                }
             case 98:
                 {
                     //杩囨湡鍨嬩唬閲戝埜
@@ -1129,19 +1147,48 @@
     public static string ShowUseMoney(int moneyType, long useCnt, TextColType engoughColor = TextColType.Green)
     {
         long cnt = GetMoneyCnt(moneyType);
-        return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(useCnt)}/{ReplaceLargeNum(cnt)}");
+        return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(cnt)}/{ReplaceLargeNum(useCnt)}");
     }
 
     public static string ShowUseItem(PackType type, int itemId, long useCnt, TextColType engoughColor = TextColType.Green)
     {
         long cnt = PackManager.Instance.GetItemCountByID(type, itemId);
-        return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(useCnt)}/{ReplaceLargeNum(cnt)}");
+        return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(cnt)}/{ReplaceLargeNum(useCnt)}");
     }
+
+
+    /// <param name="needTips">0 涓嶅搷搴� 1 寮规彁绀� 2 寮硅幏鍙栭�斿緞tips</param>
+    public static bool CheckMoneyCount(int moneyType, long needCount, int needTips = 0)
+    {
+        if (needCount <= 0)
+        {
+            return true;
+        }
+
+        long haveCount = GetMoneyCnt(moneyType);
+
+        bool isEnough = haveCount >= needCount;
+
+        if (!isEnough)
+        {
+            if (needTips == 1)
+            {
+                SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
+            }
+            else if (needTips == 2)
+            {
+                ItemTipUtility.ShowMoneyTip(moneyType);
+            }
+        }
+
+        return isEnough;
+    }
+
 
     #endregion
 
     #region 寰楀埌瑁呭浣嶆垨鑰呯绂忔爲鍝佽川鍚嶇О 甯﹂鑹�
-    public static string GetQualityNameWithColor(int quality, string format="{0}")
+    public static string GetQualityNameWithColor(int quality, string format = "{0}")
     {
         return AppendColor(quality, string.Format(format, Language.Get("equipQuality" + quality)), true, 1);
     }
@@ -1221,13 +1268,15 @@
         return content;
     }
 
+    //妫�鏌ュ悕瀛楅暱搴︼紝鐜╁鍚嶅拰鍏細鍚�
+    //涓嶅悓鍥藉闀垮害涓嶅悓锛屾帓鐗堜笉鍚�
     public static bool SatisfyNameLength(string name, out int error)
     {
         error = 0;
         //bool pureChinese = Regex.IsMatch(name, "^[\u4e00-\u9fa5]+$");
         //var chsCount = GetChsCount(name);
         int length = Encoding.Default.GetBytes(name).Length;
-        var maxlength = 20;
+        var maxlength = 14;  //绾腑鏂囦笉寤鸿瓒呰繃7涓瓧
         var minlength = 3;
         if (length > maxlength)
         {
@@ -1325,4 +1374,26 @@
         return money / scale;
     }
 
+
+    public static string RemoveColor(string content)
+    {
+        content = WordAnalysis.Color_Start_Regex.Replace(content, string.Empty);
+        content = WordAnalysis.Color_End_Regex.Replace(content, string.Empty);
+        return content;
+    }
+
+    //澶嶅埗鍒板壀璐存澘
+    // TODO 鏆備笉鏀寔web鍚庣画琛ュ厖
+    public static void CopyToClipboard(string text)
+    {
+        GUIUtility.systemCopyBuffer = text;
+        Debug.Log("鏂囧瓧宸插鍒跺埌鍓创鏉�: " + text);
+    }
+    
+    //鑾峰彇鍓垏鏉垮唴瀹�
+    public static string GetClipboardText()
+    {
+        return GUIUtility.systemCopyBuffer;
+    }
+    
 }

--
Gitblit v1.8.0