// Token: 0x060062A4 RID: 25252 RVA: 0x0022F1A8 File Offset: 0x0022D5A8 protected VRCUiCursor.CursorOver[] CheckCursorTouch(VRCUiCursor.CursorRaycast target) { if (VRCPlayer.Instance == null) { return(new VRCUiCursor.CursorOver[0]); } VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left); if (handGrasper != null && handGrasper.IsHoldingObject()) { return(new VRCUiCursor.CursorOver[0]); } int num = -1; Vector3 point = Vector3.zero; Vector3 normal = Vector3.zero; float num2 = float.PositiveInfinity; VRC_Interactable[] array = null; VRC_Pickup vrc_Pickup = null; VRC_PlayerApi apiPlayer = VRCPlayer.Instance.apiPlayer; Collider[] array2 = Physics.OverlapSphere(target.touch.position, target.touch.radius, VRCUiCursorManager.GetCurrentInteractiveLayers()); for (int i = 0; i < array2.Length; i++) { bool flag = false; Vector3 vector = PhysicsUtil.ClosestPointOnCollider(array2[i], target.touch.position, ref flag); Vector3 vector2 = vector - target.touch.position; float dist = (!flag) ? vector2.magnitude : 0f; if (dist <= target.touch.radius) { VRC_Interactable[] array3 = (from inter in array2[i].GetComponents <VRC_Interactable>() where inter.IsInteractiveForPlayer(apiPlayer) select inter).ToArray <VRC_Interactable>(); VRC_Pickup vrc_Pickup2 = array2[i].GetComponent <VRC_Pickup>(); if (array3.Length != 0 || !(vrc_Pickup2 == null)) { if (array3 != null && (array3.Length == 0 || array3.All((VRC_Interactable x) => dist > x.proximity))) { array3 = null; } VRC_StationInternal component = array2[i].GetComponent <VRC_StationInternal>(); if (array3 != null && component != null && component.Occupant == VRCPlayer.Instance.gameObject) { array3 = null; } if (vrc_Pickup2 != null && (!vrc_Pickup2.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup2.IsHeld && vrc_Pickup2.DisallowTheft && vrc_Pickup2.currentPlayer != apiPlayer))) { vrc_Pickup2 = null; } if (vrc_Pickup2 != null && vrc_Pickup2.currentlyHeldBy != null && dist > VRCHandGrasper.LerpToHandMinDistance) { vrc_Pickup2 = null; } if ((vrc_Pickup2 != null && vrc_Pickup == null) || dist <= num2) { if (!(vrc_Pickup2 == null) || (array3 != null && array3.Length != 0)) { num = i; num2 = dist; point = vector; normal = vector2.normalized; array = array3; vrc_Pickup = vrc_Pickup2; } } } } } if (num < 0) { return(new VRCUiCursor.CursorOver[0]); } target.hitInfo.distance = num2; target.hitInfo.normal = normal; target.hitInfo.point = point; target.pickup = vrc_Pickup; target.interactable = array; if (vrc_Pickup != null && array != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Pickup, VRCUiCursor.CursorOver.Interactable }; } else if (array != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Interactable }; } else if (vrc_Pickup != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Pickup }; } else { target.over = new VRCUiCursor.CursorOver[0]; } return(target.over); }
// Token: 0x060062A5 RID: 25253 RVA: 0x0022F56C File Offset: 0x0022D96C protected VRCUiCursor.CursorOver[] CastCursorRay(VRCUiCursor.CursorRaycast target) { target.over = new VRCUiCursor.CursorOver[0]; List <VRCUiCursor.CursorOver> list = new List <VRCUiCursor.CursorOver>(); int layerMask = VRCUiCursorManager.GetCurrentInteractiveLayers(); Ray ray = target.ray; float num = 0f; float num2 = 100f; while (num2 > 0f && list.Count == 0) { ray.origin += ray.direction * num; num2 -= num; RaycastHit hitInfo; if (!Physics.Raycast(ray, out hitInfo, num2, layerMask)) { target.hitInfo.distance = 10f; target.hitInfo.point = target.ray.origin + target.ray.direction * 10f; break; } num = hitInfo.distance + 0.01f; GameObject gameObject = hitInfo.collider.gameObject; VRC_UiShape component = gameObject.GetComponent <VRC_UiShape>(); if (component != null) { target.hitInfo = hitInfo; target.uiShape = component; list.Add(VRCUiCursor.CursorOver.Ui); } else if (gameObject.GetComponentInParent <VRCPlayer>() != null) { if (this.uiMenuLayer < 0) { this.uiMenuLayer = LayerMask.NameToLayer("UiMenu"); } if (gameObject.layer == this.uiMenuLayer) { target.hitInfo = hitInfo; target.player = gameObject.GetComponentInParent <VRCPlayer>(); list.Add(VRCUiCursor.CursorOver.Player); } } if (VRCPlayer.Instance != null) { VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left); if (!(handGrasper != null) || !handGrasper.IsHoldingObject()) { float num3 = 0f; if (target.extraReach) { num3 = VRCTrackingManager.GetRayReach(target.ray); } VRC_PlayerApi apiPlayer = VRCPlayer.Instance.apiPlayer; float range = hitInfo.distance - num3; VRC_Interactable[] array = (from inter in gameObject.GetComponents <VRC_Interactable>() where range <= inter.proximity && inter.IsInteractiveForPlayer(apiPlayer) select inter).ToArray <VRC_Interactable>(); VRC_Pickup vrc_Pickup = gameObject.GetComponent <VRC_Pickup>(); if (array.Length == 0) { array = null; } VRC_StationInternal component2 = gameObject.GetComponent <VRC_StationInternal>(); if (array != null && component2 != null && component2.Occupant == VRCPlayer.Instance.gameObject) { array = null; } if (vrc_Pickup != null && (!vrc_Pickup.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup.IsHeld && vrc_Pickup.DisallowTheft && vrc_Pickup.currentPlayer != apiPlayer))) { vrc_Pickup = null; } if (array != null && vrc_Pickup != null) { target.hitInfo = hitInfo; target.interactable = array; target.pickup = vrc_Pickup; list.Add(VRCUiCursor.CursorOver.Pickup); list.Add(VRCUiCursor.CursorOver.Interactable); } else if (array != null) { target.hitInfo = hitInfo; target.interactable = array; list.Add(VRCUiCursor.CursorOver.Interactable); VRC_WebPanel component3 = gameObject.GetComponent <VRC_WebPanel>(); if (component3 != null && component3.interactive) { target.hitInfo = hitInfo; target.webPanel = component3.GetComponent <WebPanelInternal>(); list.Add(VRCUiCursor.CursorOver.Web); } } else if (vrc_Pickup != null && range <= 0f) { target.hitInfo = hitInfo; target.pickup = vrc_Pickup; list.Add(VRCUiCursor.CursorOver.Pickup); } if (list.Count == 0) { if (Vector3.Dot(Vector3.up, hitInfo.normal) > 0.7f) { target.hitInfo = hitInfo; list.Add(VRCUiCursor.CursorOver.Floor); } else { target.hitInfo = hitInfo; list.Add(VRCUiCursor.CursorOver.Other); } } } } else { VRC_WebPanel component4 = gameObject.GetComponent <VRC_WebPanel>(); if (component4 != null && component4.interactive) { target.hitInfo = hitInfo; target.webPanel = component4.GetComponent <WebPanelInternal>(); list.Add(VRCUiCursor.CursorOver.Web); } } } target.over = list.ToArray(); return(target.over); }