public static GameObject PickGameObject(Vector2 mousePosition) { SceneViewPicking.s_RetainHashes = true; IEnumerator <GameObject> enumerator = SceneViewPicking.GetAllOverlapping(mousePosition).GetEnumerator(); GameObject result; if (!enumerator.MoveNext()) { result = null; } else { GameObject current = enumerator.Current; GameObject gameObject = HandleUtility.FindSelectionBase(current); GameObject gameObject2 = (!(gameObject == null)) ? gameObject : current; int hashCode = current.GetHashCode(); int num = hashCode; if (Selection.activeGameObject == null) { SceneViewPicking.s_PreviousTopmostHash = hashCode; SceneViewPicking.s_PreviousPrefixHash = num; result = gameObject2; } else if (hashCode != SceneViewPicking.s_PreviousTopmostHash) { SceneViewPicking.s_PreviousTopmostHash = hashCode; SceneViewPicking.s_PreviousPrefixHash = num; result = ((!(Selection.activeGameObject == gameObject)) ? gameObject2 : current); } else { SceneViewPicking.s_PreviousTopmostHash = hashCode; if (Selection.activeGameObject == gameObject) { if (num == SceneViewPicking.s_PreviousPrefixHash) { result = current; } else { SceneViewPicking.s_PreviousPrefixHash = num; result = gameObject; } } else { GameObject x = HandleUtility.PickGameObject(mousePosition, false, null, new GameObject[] { Selection.activeGameObject }); if (x == Selection.activeGameObject) { while (enumerator.Current != Selection.activeGameObject) { if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; result = gameObject2; return(result); } SceneViewPicking.UpdateHash(ref num, enumerator.Current); } } if (num != SceneViewPicking.s_PreviousPrefixHash) { SceneViewPicking.s_PreviousPrefixHash = hashCode; result = gameObject2; } else if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; result = gameObject2; } else { SceneViewPicking.UpdateHash(ref num, enumerator.Current); if (enumerator.Current == gameObject) { if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; result = gameObject2; return(result); } SceneViewPicking.UpdateHash(ref num, enumerator.Current); } SceneViewPicking.s_PreviousPrefixHash = num; result = enumerator.Current; } } } } return(result); }
public static GameObject PickGameObject(Vector2 mousePosition) { SceneViewPicking.s_RetainHashes = true; IEnumerator <GameObject> enumerator = SceneViewPicking.GetAllOverlapping(mousePosition).GetEnumerator(); if (!enumerator.MoveNext()) { return((GameObject)null); } GameObject current = enumerator.Current; GameObject selectionBase = HandleUtility.FindSelectionBase(current); GameObject gameObject = !((UnityEngine.Object)selectionBase == (UnityEngine.Object)null) ? selectionBase : current; int hashCode = current.GetHashCode(); int hash = hashCode; if ((UnityEngine.Object)Selection.activeGameObject == (UnityEngine.Object)null || hashCode != SceneViewPicking.s_PreviousTopmostHash) { SceneViewPicking.s_PreviousTopmostHash = hashCode; SceneViewPicking.s_PreviousPrefixHash = hash; return(gameObject); } SceneViewPicking.s_PreviousTopmostHash = hashCode; if ((UnityEngine.Object)selectionBase != (UnityEngine.Object)null && (UnityEngine.Object)Selection.activeGameObject == (UnityEngine.Object)selectionBase) { if (hash == SceneViewPicking.s_PreviousPrefixHash) { return(current); } SceneViewPicking.s_PreviousPrefixHash = hash; return(selectionBase); } if ((UnityEngine.Object)HandleUtility.PickGameObject(mousePosition, 0 != 0, (GameObject[])null, new GameObject[1] { Selection.activeGameObject }) == (UnityEngine.Object)Selection.activeGameObject) { while ((UnityEngine.Object)enumerator.Current != (UnityEngine.Object)Selection.activeGameObject) { if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; return(gameObject); } SceneViewPicking.UpdateHash(ref hash, (object)enumerator.Current); } } if (hash != SceneViewPicking.s_PreviousPrefixHash) { SceneViewPicking.s_PreviousPrefixHash = hashCode; return(gameObject); } if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; return(gameObject); } SceneViewPicking.UpdateHash(ref hash, (object)enumerator.Current); if ((UnityEngine.Object)enumerator.Current == (UnityEngine.Object)selectionBase) { if (!enumerator.MoveNext()) { SceneViewPicking.s_PreviousPrefixHash = hashCode; return(gameObject); } SceneViewPicking.UpdateHash(ref hash, (object)enumerator.Current); } SceneViewPicking.s_PreviousPrefixHash = hash; return(enumerator.Current); }