private static SendEvents ( int i, HitInfo hit ) : void | ||
i | int | |
hit | HitInfo | |
Результат | void |
private static void DoSendMouseEvents(int skipRTCameras) { Vector3 mousePosition = Input.mousePosition; int allCamerasCount = Camera.allCamerasCount; if (SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount) { SendMouseEvents.m_Cameras = new Camera[allCamerasCount]; } Camera.GetAllCameras(SendMouseEvents.m_Cameras); for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; i++) { SendMouseEvents.m_CurrentHit[i] = default(SendMouseEvents.HitInfo); } if (!SendMouseEvents.s_MouseUsed) { Camera[] cameras = SendMouseEvents.m_Cameras; for (int j = 0; j < cameras.Length; j++) { Camera camera = cameras[j]; if (!(camera == null) && (skipRTCameras == 0 || !(camera.targetTexture != null))) { if (camera.pixelRect.Contains(mousePosition)) { GUILayer component = camera.GetComponent <GUILayer>(); if (component) { GUIElement gUIElement = component.HitTest(mousePosition); if (gUIElement) { SendMouseEvents.m_CurrentHit[0].target = gUIElement.gameObject; SendMouseEvents.m_CurrentHit[0].camera = camera; } else { SendMouseEvents.m_CurrentHit[0].target = null; SendMouseEvents.m_CurrentHit[0].camera = null; } } if (camera.eventMask != 0) { Ray ray = camera.ScreenPointToRay(mousePosition); float z = ray.direction.z; float distance = (!Mathf.Approximately(0f, z)) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity; GameObject gameObject = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask); if (gameObject != null) { SendMouseEvents.m_CurrentHit[1].target = gameObject; SendMouseEvents.m_CurrentHit[1].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[1].target = null; SendMouseEvents.m_CurrentHit[1].camera = null; } GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask); if (gameObject2 != null) { SendMouseEvents.m_CurrentHit[2].target = gameObject2; SendMouseEvents.m_CurrentHit[2].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[2].target = null; SendMouseEvents.m_CurrentHit[2].camera = null; } } } } } } for (int k = 0; k < SendMouseEvents.m_CurrentHit.Length; k++) { SendMouseEvents.SendEvents(k, SendMouseEvents.m_CurrentHit[k]); } SendMouseEvents.s_MouseUsed = false; }
private static void DoSendMouseEvents(int skipRTCameras) { Vector3 mousePosition = Input.mousePosition; int allCamerasCount = Camera.allCamerasCount; if (SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount) { SendMouseEvents.m_Cameras = new Camera[allCamerasCount]; } Camera.GetAllCameras(SendMouseEvents.m_Cameras); for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; i++) { SendMouseEvents.m_CurrentHit[i] = default(SendMouseEvents.HitInfo); } if (!SendMouseEvents.s_MouseUsed) { foreach (Camera camera in SendMouseEvents.m_Cameras) { if (!(camera == null) && (skipRTCameras == 0 || !(camera.targetTexture != null))) { int targetDisplay = camera.targetDisplay; Vector3 vector = Display.RelativeMouseAt(mousePosition); if (vector != Vector3.zero) { int num = (int)vector.z; if (num != targetDisplay) { goto IL_361; } float num2 = (float)Screen.width; float num3 = (float)Screen.height; if (targetDisplay > 0 && targetDisplay < Display.displays.Length) { num2 = (float)Display.displays[targetDisplay].systemWidth; num3 = (float)Display.displays[targetDisplay].systemHeight; } Vector2 vector2 = new Vector2(vector.x / num2, vector.y / num3); if (vector2.x < 0f || vector2.x > 1f || vector2.y < 0f || vector2.y > 1f) { goto IL_361; } } else { vector = mousePosition; if (!camera.pixelRect.Contains(vector)) { goto IL_361; } } SendMouseEvents.HitTestLegacyGUI(camera, vector, ref SendMouseEvents.m_CurrentHit[0]); if (camera.eventMask != 0) { Ray ray = camera.ScreenPointToRay(vector); float z = ray.direction.z; float distance = (!Mathf.Approximately(0f, z)) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity; GameObject gameObject = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask); if (gameObject != null) { SendMouseEvents.m_CurrentHit[1].target = gameObject; SendMouseEvents.m_CurrentHit[1].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[1].target = null; SendMouseEvents.m_CurrentHit[1].camera = null; } GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask); if (gameObject2 != null) { SendMouseEvents.m_CurrentHit[2].target = gameObject2; SendMouseEvents.m_CurrentHit[2].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[2].target = null; SendMouseEvents.m_CurrentHit[2].camera = null; } } } IL_361 :; } } for (int k = 0; k < SendMouseEvents.m_CurrentHit.Length; k++) { SendMouseEvents.SendEvents(k, SendMouseEvents.m_CurrentHit[k]); } SendMouseEvents.s_MouseUsed = false; }
private static void DoSendMouseEvents(int skipRTCameras) { Vector3 mousePosition = Input.mousePosition; int allCamerasCount = Camera.allCamerasCount; if (SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount) { SendMouseEvents.m_Cameras = new Camera[allCamerasCount]; } Camera.GetAllCameras(SendMouseEvents.m_Cameras); for (int index = 0; index < SendMouseEvents.m_CurrentHit.Length; ++index) { SendMouseEvents.m_CurrentHit[index] = new SendMouseEvents.HitInfo(); } if (!SendMouseEvents.s_MouseUsed) { foreach (Camera camera in SendMouseEvents.m_Cameras) { if (!((Object)camera == (Object)null) && (skipRTCameras == 0 || !((Object)camera.targetTexture != (Object)null)) && camera.pixelRect.Contains(mousePosition)) { GUILayer component = camera.GetComponent <GUILayer>(); if ((bool)((Object)component)) { GUIElement guiElement = component.HitTest(mousePosition); if ((bool)((Object)guiElement)) { SendMouseEvents.m_CurrentHit[0].target = guiElement.gameObject; SendMouseEvents.m_CurrentHit[0].camera = camera; } else { SendMouseEvents.m_CurrentHit[0].target = (GameObject)null; SendMouseEvents.m_CurrentHit[0].camera = (Camera)null; } } if (camera.eventMask != 0) { Ray ray = camera.ScreenPointToRay(mousePosition); float z = ray.direction.z; float distance = !Mathf.Approximately(0.0f, z) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity; GameObject gameObject1 = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask); if ((Object)gameObject1 != (Object)null) { SendMouseEvents.m_CurrentHit[1].target = gameObject1; SendMouseEvents.m_CurrentHit[1].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[1].target = (GameObject)null; SendMouseEvents.m_CurrentHit[1].camera = (Camera)null; } GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask); if ((Object)gameObject2 != (Object)null) { SendMouseEvents.m_CurrentHit[2].target = gameObject2; SendMouseEvents.m_CurrentHit[2].camera = camera; } else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color) { SendMouseEvents.m_CurrentHit[2].target = (GameObject)null; SendMouseEvents.m_CurrentHit[2].camera = (Camera)null; } } } } } for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; ++i) { SendMouseEvents.SendEvents(i, SendMouseEvents.m_CurrentHit[i]); } SendMouseEvents.s_MouseUsed = false; }
private static void DoSendMouseEvents(int skipRTCameras) { Vector3 mousePosition = Input.mousePosition; int allCamerasCount = Camera.allCamerasCount; bool flag = SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount; if (flag) { SendMouseEvents.m_Cameras = new Camera[allCamerasCount]; } Camera.GetAllCameras(SendMouseEvents.m_Cameras); for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; i++) { SendMouseEvents.m_CurrentHit[i] = default(SendMouseEvents.HitInfo); } bool flag2 = !SendMouseEvents.s_MouseUsed; if (flag2) { Camera[] cameras = SendMouseEvents.m_Cameras; for (int j = 0; j < cameras.Length; j++) { Camera camera = cameras[j]; bool flag3 = camera == null || (skipRTCameras != 0 && camera.targetTexture != null); if (!flag3) { int targetDisplay = camera.targetDisplay; Vector3 vector = Display.RelativeMouseAt(mousePosition); bool flag4 = vector != Vector3.zero; if (flag4) { int num = (int)vector.z; bool flag5 = num != targetDisplay; if (flag5) { goto IL_358; } float num2 = (float)Screen.width; float num3 = (float)Screen.height; bool flag6 = targetDisplay > 0 && targetDisplay < Display.displays.Length; if (flag6) { num2 = (float)Display.displays[targetDisplay].systemWidth; num3 = (float)Display.displays[targetDisplay].systemHeight; } Vector2 vector2 = new Vector2(vector.x / num2, vector.y / num3); bool flag7 = vector2.x <0f || vector2.x> 1f || vector2.y <0f || vector2.y> 1f; if (flag7) { goto IL_358; } } else { vector = mousePosition; } bool flag8 = !camera.pixelRect.Contains(vector); if (!flag8) { bool flag9 = camera.eventMask == 0; if (!flag9) { Ray ray = camera.ScreenPointToRay(vector); float z = ray.direction.z; float distance = Mathf.Approximately(0f, z) ? float.PositiveInfinity : Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z); GameObject gameObject = CameraRaycastHelper.RaycastTry(camera, ray, distance, camera.cullingMask & camera.eventMask); bool flag10 = gameObject != null; if (flag10) { SendMouseEvents.m_CurrentHit[1].target = gameObject; SendMouseEvents.m_CurrentHit[1].camera = camera; } else { bool flag11 = camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color; if (flag11) { SendMouseEvents.m_CurrentHit[1].target = null; SendMouseEvents.m_CurrentHit[1].camera = null; } } GameObject gameObject2 = CameraRaycastHelper.RaycastTry2D(camera, ray, distance, camera.cullingMask & camera.eventMask); bool flag12 = gameObject2 != null; if (flag12) { SendMouseEvents.m_CurrentHit[2].target = gameObject2; SendMouseEvents.m_CurrentHit[2].camera = camera; } else { bool flag13 = camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color; if (flag13) { SendMouseEvents.m_CurrentHit[2].target = null; SendMouseEvents.m_CurrentHit[2].camera = null; } } } } } IL_358 :; } } for (int k = 0; k < SendMouseEvents.m_CurrentHit.Length; k++) { SendMouseEvents.SendEvents(k, SendMouseEvents.m_CurrentHit[k]); } SendMouseEvents.s_MouseUsed = false; }