From 99a11d2bb19d74f6cc8584ac16838062af4fb301 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 03 四月 2026 11:24:07 +0800
Subject: [PATCH] webgl 优化

---
 Main/Utility/UGUIEventListenerContainDrag.cs |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/Main/Utility/UGUIEventListenerContainDrag.cs b/Main/Utility/UGUIEventListenerContainDrag.cs
index 56e7dfd..3f08808 100644
--- a/Main/Utility/UGUIEventListenerContainDrag.cs
+++ b/Main/Utility/UGUIEventListenerContainDrag.cs
@@ -28,12 +28,28 @@
     //鏄惁澶勪簬鎸変笅鐘舵�� 涓庨暱鎸夐厤鍚堜娇鐢�
     bool isDown = false;
     float time = 0;
+    
+    private Button _cachedButton;
+    private bool _buttonCached;
+    
+    private Button CachedButton
+    {
+        get
+        {
+            if (!_buttonCached)
+            {
+                _cachedButton = GetComponent<Button>();
+                _buttonCached = true;
+            }
+            return _cachedButton;
+        }
+    }
 
     public void OnPointerClick(PointerEventData eventData)
     {
         if (OnClick != null)
         {
-            if (!GetComponent<Button>() || GetComponent<Button>().interactable)
+            if (!CachedButton || CachedButton.interactable)
             {
                 OnClick(gameObject);
             }

--
Gitblit v1.8.0