From eb27e5fd31f73b998a4bbd85511a31e40b8c61b7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 21 十一月 2025 17:03:47 +0800
Subject: [PATCH] 0312 关闭游戏内日志

---
 Main/Utility/ComponentExtersion.cs |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/Main/Utility/ComponentExtersion.cs b/Main/Utility/ComponentExtersion.cs
index 17601fc..c7aadbc 100644
--- a/Main/Utility/ComponentExtersion.cs
+++ b/Main/Utility/ComponentExtersion.cs
@@ -255,7 +255,40 @@
         }
     }
 
-
+    public static void SetColorful(this GroupButtonEx _btn, Text _btnTxt, bool _colorful, int pattern = 0)
+    {
+        if (_btn != null)
+        {
+            if (_btn.selectIcon != null)
+            {
+                _btn.selectIcon.gray = !_colorful;
+            }
+            if (_btn.unSelectIcon != null)
+            {
+                _btn.unSelectIcon.gray = !_colorful;
+            }
+        }
+        if (_btnTxt != null)
+        {
+            switch (pattern)
+            {
+                case 1:
+                    _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.LightWhite : TextColType.White);
+                    break;
+                case 2:
+                    _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.Green : TextColType.White);
+                    break;
+                default:
+                    //false 鐏拌壊锛宼rue 鍘熻壊
+                    if (!_colorful)
+                        _btnTxt.text = UIHelper.AppendColor(TextColType.NavyGray, _btnTxt.text);    //涓嶆敼鍙樼粍浠堕鑹诧紝鍙敼鍙樻樉绀洪鑹�
+                    else
+                        _btnTxt.text = UIHelper.AppendColor(_btnTxt.color, _btnTxt.text);
+                    break;
+            }
+        }
+    }
+    
     // 璁剧疆鎸夐挳鏄惁鍙偣鍑伙紝涓斿彇绗竴涓枃鏈粍浠剁疆鐏版垨缃師鑹�
     // 瑕佸厛璁剧疆鏂囨湰鍐嶈皟鐢ㄨ鍑芥暟 鍥犱负娌℃湁鏀瑰彉鏂囨湰缁勪欢鐨勯鑹查伩鍏嶉鑹茶杩樺師锛屽悓鐞嗘仮澶嶅彲浠ヤ笉鐢ㄦ敼鍙橀鑹叉敼鏂囧瓧鍗冲彲
     // 鏇村鍔熻兘璇蜂娇鐢⊿etColorful
@@ -290,6 +323,12 @@
             return;
         }
 
+        if (string.IsNullOrEmpty(_id))
+        {
+            Debug.LogError("Image SetSprite id is null or empty " + _id);
+            return;
+        }
+
         var sprite = UILoader.LoadSprite(_id);
         _image.overrideSprite = sprite;
     }
@@ -302,6 +341,12 @@
             return;
         }
 
+        if (string.IsNullOrEmpty(_id))
+        {
+            Debug.LogError("TextImage SetSprite id is null or empty " + _id);
+            return;
+        }
+
         var sprite = UILoader.LoadSprite(_id);
         _textImage.sprite = sprite;
     }
@@ -311,6 +356,12 @@
     {
         if (_image == null)
         {
+            return;
+        }
+
+        if (string.IsNullOrEmpty(iconName))
+        {
+            Debug.LogError("SetOrgSprite iconName is null or empty " + iconName);
             return;
         }
 
@@ -332,6 +383,12 @@
             return;
         }
 
+        if (string.IsNullOrEmpty(itemConfig.IconKey))
+        {
+            Debug.LogError("SetItemSprite IconKey is null or empty for itemID " + itemID);
+            return;
+        }
+
         var sprite = UILoader.LoadSprite("icon", itemConfig.IconKey);
         _image.overrideSprite = sprite;
     }
@@ -346,6 +403,12 @@
         var skillConfig = SkillConfig.Get(skillID);
         if (skillConfig == null)
         {
+            return;
+        }
+
+        if (string.IsNullOrEmpty(skillConfig.IconName))
+        {
+            Debug.LogError("SetSkillSprite IconName is null or empty for skillID " + skillID);
             return;
         }
 
@@ -388,6 +451,12 @@
             return;
         }
 
+        if (string.IsNullOrEmpty(_id))
+        {
+            Debug.LogError("SetTexture2DPNG id is null or empty " + _id);
+            return;
+        }
+
         var texture = UILoader.LoadTexture2DPNG(_id);
         _image.texture = texture;
     }

--
Gitblit v1.8.0