Browse Source

Merge branch 'master' into XRSDK_Phone

胡佳骏 1 year ago
parent
commit
4c6c21c563
1 changed files with 13 additions and 10 deletions
  1. 13 10
      Samples~/SDK/AllMoveEvent.cs

+ 13 - 10
Samples~/SDK/AllMoveEvent.cs

@@ -14,11 +14,11 @@ public class AllMoveEvent : MonoBehaviour
 
     }
 
-    InputDevicePartBase NowPart ;
+    InputDevicePartBase NowPart;
 
     private void upEvent(InputKeyCode keyCode, InputDevicePartBase part)
     {
-        if(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject!=null&& part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>()==null)
+        if (part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject != null && part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>() == null)
         {
             checkMoveUp(part.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject, part);
         }
@@ -27,12 +27,13 @@ public class AllMoveEvent : MonoBehaviour
 
     public void checkMoveUp(GameObject obj, InputDevicePartBase part)
     {
-        if(obj)
+        if (obj)
         {
             ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
-            if(m!=null)
+            if (m != null)
             {
-                m.OnPointerUp(part.inputDataBase.SCPointEventData);
+                if (!m.isParentDrag)
+                    m.OnPointerUp(part.inputDataBase.SCPointEventData);
             }
             else
             {
@@ -58,7 +59,8 @@ public class AllMoveEvent : MonoBehaviour
             ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
             if (m != null)
             {
-                m.OnPointerDown(part.inputDataBase.SCPointEventData);
+                if (!m.isParentDrag)
+                    m.OnPointerDown(part.inputDataBase.SCPointEventData);
             }
             else
             {
@@ -72,7 +74,7 @@ public class AllMoveEvent : MonoBehaviour
     // Update is called once per frame
     void Update()
     {
-        if (NowPart!=null&&NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject != null && NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>() == null)
+        if (NowPart != null && NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject != null && NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject.GetComponent<BoxCollider>() == null)
         {
 
             checkMoveDrag(NowPart.inputDataBase.SCPointEventData.pointerCurrentRaycast.gameObject, NowPart);
@@ -86,12 +88,13 @@ public class AllMoveEvent : MonoBehaviour
             ManipulationHandler m = obj.GetComponent<ManipulationHandler>();
             if (m != null)
             {
-                m.OnDrag(part.inputDataBase.SCPointEventData);
+                if (!m.isParentDrag)
+                    m.OnDrag(part.inputDataBase.SCPointEventData);
             }
             else
             {
-                if(obj.transform.parent!=null)
-                checkMoveDrag(obj.transform.parent.gameObject, part);
+                if (obj.transform.parent != null)
+                    checkMoveDrag(obj.transform.parent.gameObject, part);
             }
         }
     }