private void onPointerButtonInputUp(PointerButtonInputEventArgs args)
        {
            PointerInputEventArgs pointerInput = _pointerInputRegistry.GetPointerInput(_parameter.PointerParameter.PointerButtonIndex);

            if (args.Duration > _parameter.InputParameter.MaxClickDuration ||
                (pointerInput.ScreenPosition - _pointerInputOnClickStart.ScreenPosition).magnitude > _parameter.InputParameter.MaxPointerDelta)
            {
                clean();
                return;
            }

            List <PointerRaycastHit> hits = new List <PointerRaycastHit>();

            foreach (PointerRaycastHit hit in pointerInput.RaycastHits)
            {
                foreach (PointerRaycastHit clickStartHit in _pointerInputOnClickStart.RaycastHits)
                {
                    if (hit.Obj != clickStartHit.Obj)
                    {
                        continue;
                    }
                    hits.Add(clickStartHit);
                }
            }

            OnClick?.Invoke(new ClickInputEventArgs(hits.ToArray(), _pointerInputOnClickStart));
            clean();
        }
 public SelectableInputEventArgs(
     Selectable selectable,
     PointerRaycastHit raycastHit,
     PointerInputEventArgs pointerInput)
 {
     Selectable   = selectable;
     RaycastHit   = raycastHit;
     PointerInput = pointerInput;
 }
Beispiel #3
0
        public override PointersInputEventArgs GetPointerInputs()
        {
            Vector2 mousePos = UnityEngine.Input.mousePosition;
            Vector2 delta    = mousePos - _formerPos;

            _formerPos = mousePos;
            RaycastAllResult      result            = raycastAt(mousePos);
            PointerInputEventArgs mousePointerInput = new PointerInputEventArgs(mousePos, delta, result.Hits, result.IsOverUI);

            return(new PointersInputEventArgs(new List <PointerInputEventArgs>()
            {
                mousePointerInput
            }));
        }
Beispiel #4
0
        public override PointersInputEventArgs GetPointerInputs()
        {
            List <PointerInputEventArgs> pointerInputs = new List <PointerInputEventArgs>();
            int border = Mathf.Min(_maxPointer, UnityEngine.Input.touchCount);

            for (int i = 0; i < border; i++)
            {
                Touch                 touch             = UnityEngine.Input.touches[i];
                Vector2               touchPos          = touch.position;
                RaycastAllResult      result            = raycastAt(touchPos);
                PointerInputEventArgs touchPointerInput = new PointerInputEventArgs(touchPos, touch.deltaPosition, result.Hits, result.IsOverUI);
                pointerInputs.Add(touchPointerInput);
            }
            return(new PointersInputEventArgs(pointerInputs));
        }
 private void clean()
 {
     _pointerInputOnClickStart = null;
 }
 private void onPointerButtonInputDown(PointerButtonInputEventArgs args)
 {
     _pointerInputOnClickStart = _pointerInputRegistry.GetPointerInput(_parameter.PointerParameter.PointerButtonIndex);
 }
 private SelectableInputEventArgs createArgs(TSelectable selectable, PointerRaycastHit hit, PointerInputEventArgs args)
 {
     return(new SelectableInputEventArgs(selectable, hit, args));
 }
Beispiel #8
0
 public ClickInputEventArgs(PointerRaycastHit[] clickedObjects,
                            PointerInputEventArgs pointerInput)
 {
     ClickedObjects = clickedObjects;
     PointerInput   = pointerInput;
 }
 public ClickableInputEventArgs(PointerRaycastHit raycastHit,
                                PointerInputEventArgs pointerInput)
 {
     RaycastHit   = raycastHit;
     PointerInput = pointerInput;
 }