private static void Selectable_OnPointerExit_Postfix(Selectable __instance, PointerEventData eventData) { OnPointerExit?.Invoke(__instance, new PointerEventArgs(__instance, eventData)); }
private void OnMouseExit() => OnPointerExit?.Invoke(this);
public virtual void InvokeExit() => OnPointerExit?.Invoke();
void IPointerExitHandler.OnPointerExit(PointerEventData eventData) { OnPointerExit?.Invoke(); }
private void Update() { //Raycast from the current camera forward if (Physics.Raycast(transform.position, transform.forward, out pointerHit, 250f)) { //Update the current pointer args currPointerArgs.target = pointerHit.transform; currPointerArgs.point = pointerHit.point; currPointerArgs.normal = pointerHit.normal; if (prevPointerArgs.target == null || pointerHit.transform == prevPointerArgs.target) { timeToClickCountdown -= Time.deltaTime; //Send the entered event if (enteredTriggered == false) { OnPointerEnter?.Invoke(this, currPointerArgs); enteredTriggered = true; } if (timeToClickCountdown <= 0) { //Send the one time click event if (clickTriggered == false) { OnPointerClicked?.Invoke(this, currPointerArgs); ExecuteEvents.Execute(pointerHit.transform.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler); clickTriggered = true; } OnPointerDown?.Invoke(this, currPointerArgs); //Set the previous hit to the new target prevPointerArgs.target = pointerHit.transform; prevPointerArgs.point = pointerHit.point; prevPointerArgs.normal = pointerHit.normal; } } else { //Exit the old target and enter the new one OnPointerExit?.Invoke(this, prevPointerArgs); OnPointerEnter?.Invoke(this, currPointerArgs); //Set the previous hit to the new target prevPointerArgs.target = pointerHit.transform; prevPointerArgs.point = pointerHit.point; prevPointerArgs.normal = pointerHit.normal; //Reset state variables timeToClickCountdown = timeToClick; enteredTriggered = false; clickTriggered = false; } } else { if (prevPointerArgs.target != null) { //Send the exit event OnPointerExit?.Invoke(this, prevPointerArgs); //Reset state variables prevPointerArgs.target = null; timeToClickCountdown = timeToClick; enteredTriggered = false; clickTriggered = false; } else { timeToClickCountdown = timeToClick; } } //Draw the debug gizmos if (drawDebug) { Debug.DrawLine(transform.position, prevPointerArgs.point, Color.red); } }
public void PointerExit() { OnPointerExit?.Invoke(); }