/// <summary> /// Event called when the user is clicking on something /// </summary> /// <param name="startClickingEvent">The event raised when an object was clicked</param> private void CheckClickedObject(OnVRClickerStartClicking startClickingEvent) { if (CheckGameObject(startClickingEvent.ClickedObject)) { onClick.Invoke(); UIHapticGenerator.CreateClickHapticSignal(startClickingEvent.RaycastOrigin); } }
/// <summary> /// Event called when the DropDown or its children is clicked /// </summary> /// <param name="clickEvent">The event raised when an object is clicked</param> public void CheckClickedObject(OnVRClickerStartClicking clickEvent) { // if the clicked object is this one OR if it's something else and this dropdown was shown if (interactable && (clickEvent.ClickedObject == gameObject || _isShown)) { SetDropDownNewState(); } }
protected override void OnDestroy() { base.OnDestroy(); if (OnVRClickerStartClicking.IsCallbackRegistered(CheckClickedObject)) { OnVRClickerStartClicking.Listeners -= CheckClickedObject; } }
/// <summary> /// Event called when the user is clicking on something /// </summary> /// <param name="startClickingEvent">The event raised when an object was clicked</param> private void CheckClickedObject(OnVRClickerStartClicking startClickingEvent) { if (interactable && startClickingEvent.ClickedObject == gameObject) { StartTyping(); UIHapticGenerator.CreateClickHapticSignal(startClickingEvent.RaycastOrigin); } else { m_CaretVisible = false; } }
/// <summary> /// Event called when the user is clicking on something /// </summary> /// <param name="startClickingEvent">The event raised when an object was clicked</param> private void CheckClickedObject(OnVRClickerStartClicking startClickingEvent) { if (CanHoldHandle()) { _rayHoldingHandle = startClickingEvent.RaycastOrigin; UIHapticGenerator.CreateClickHapticSignal(_rayHoldingHandle); } bool CanHoldHandle() { return(interactable && startClickingEvent.ClickedObject == gameObject && _rayHoldingHandle == ERayOrigin.NONE); } }
protected override void OnDestroy() { base.OnDestroy(); if (OnVRClickerStartClicking.IsCallbackRegistered(CheckClickedObject)) { OnVRClickerStartClicking.Listeners -= CheckClickedObject; OnVRClickerStopClicking.Listeners -= CheckUnclickedObject; } else if (OnStartHoveringObject.IsCallbackRegistered(CheckHoveredObject)) { OnStartHoveringObject.Listeners -= CheckHoveredObject; OnStopHoveringObject.Listeners -= CheckUnhoveredObject; } }
/// <summary> /// Event called when the user is clicking on something /// </summary> /// <param name="startClickingEvent">The event raised when an object is clicked</param> private void CheckClickedObject(OnVRClickerStartClicking startClickingEvent) { CheckCanFillSlider(startClickingEvent.ClickedObject, startClickingEvent.RaycastOrigin); }