Exemplo n.º 1
0
 private static void Selectable_OnPointerExit_Postfix(Selectable __instance, PointerEventData eventData)
 {
     OnPointerExit?.Invoke(__instance, new PointerEventArgs(__instance, eventData));
 }
Exemplo n.º 2
0
 private void OnMouseExit() => OnPointerExit?.Invoke(this);
Exemplo n.º 3
0
 public virtual void InvokeExit() => OnPointerExit?.Invoke();
Exemplo n.º 4
0
 void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
 {
     OnPointerExit?.Invoke();
 }
Exemplo n.º 5
0
    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();
 }