public void RaiseSourceDown(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null) { // Create input event inputEventData.Initialize(source, sourceId, tags, pressType); // Pass handler through HandleEvent to perform modal/fallback logic HandleEvent(inputEventData, OnSourceDownEventHandler); // UI events IPointingSource pointingSource; FocusManager.Instance.TryGetPointingSource(inputEventData, out pointingSource); PointerInputEventData pointerInputEventData = FocusManager.Instance.GetSpecificPointerEventData(pointingSource); if (pointerInputEventData != null && pressType == InteractionSourcePressInfo.Select) { pointerInputEventData.InputSource = source; pointerInputEventData.SourceId = sourceId; pointerInputEventData.pointerId = (int)sourceId; pointerInputEventData.eligibleForClick = true; pointerInputEventData.delta = Vector2.zero; pointerInputEventData.dragging = false; pointerInputEventData.useDragThreshold = true; pointerInputEventData.pressPosition = pointerInputEventData.position; pointerInputEventData.pointerPressRaycast = pointerInputEventData.pointerCurrentRaycast; ExecuteEvents.ExecuteHierarchy(inputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerDownHandler); } }
/// <summary> /// Raise the event OnFocusExit to the game object when focus exists it. /// </summary> /// <param name="deFocusedObject">The object that is deFocused.</param> public void RaiseFocusExit(GameObject deFocusedObject) { ExecuteEvents.ExecuteHierarchy(deFocusedObject, null, OnFocusExitEventHandler); PointerInputEventData pointerInputEventData = FocusManager.Instance.GetGazePointerEventData(); if (pointerInputEventData != null) { ExecuteEvents.ExecuteHierarchy(deFocusedObject, pointerInputEventData, ExecuteEvents.pointerExitHandler); } }
public GameObject TryGetFocusedObject(BaseEventData eventData) { FocusDetails? details = TryGetFocusDetails(eventData); if (details == null) { return null; } IPointingSource pointingSource; TryGetPointingSource(eventData, out pointingSource); PointerInputEventData pointerInputEventData = GetSpecificPointerEventData(pointingSource); Debug.Assert(pointerInputEventData != null); pointerInputEventData.selectedObject = details.Value.Object; return details.Value.Object; }
public void RaiseSourceUp(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null) { // Create input event inputEventData.Initialize(source, sourceId, tags, pressType); // Pass handler through HandleEvent to perform modal/fallback logic HandleEvent(inputEventData, OnSourceUpEventHandler); // UI events IPointingSource pointingSource; FocusManager.Instance.TryGetPointingSource(inputEventData, out pointingSource); PointerInputEventData pointerInputEventData = FocusManager.Instance.GetSpecificPointerEventData(pointingSource); if (pointerInputEventData != null && pressType == InteractionSourcePressInfo.Select) { pointerInputEventData.InputSource = source; pointerInputEventData.SourceId = sourceId; ExecuteEvents.ExecuteHierarchy(inputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerUpHandler); ExecuteEvents.ExecuteHierarchy(inputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerClickHandler); pointerInputEventData.Clear(); } }