public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            if (touches != null && evt != null)
            {
                base.TouchesBegan(touches, evt);
            }

            OnTouched?.Invoke(this, new OnTouchedEventArgs(this));
        }
Beispiel #2
0
        public bool OnTouch(View v, MotionEvent e)
        {
            var clipData = new ClipData("Label", new string[] { ClipDescription.MimetypeTextPlain }, new ClipData.Item("Label"));

            v.StartDragAndDrop(clipData, new View.DragShadowBuilder(v), null, 0);

            OnTouched?.Invoke(this, new OnTouchedEventArgs(v));

            return(true);
        }
Beispiel #3
0
        public bool TryTouch(IGrabbable grabbable)
        {
            if (!CanTouch(grabbable))
            {
                return(false);
            }

            AddGrabbable(grabbable);
            OnTouched?.Invoke(this, grabbable);

            return(true);
        }
Beispiel #4
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
            _isTouched = true;
            _inputId++;
            _touchStartPosition = _mainCamera.ScreenToWorldPoint(Input.mousePosition);
        }
        if (Input.GetMouseButtonUp(0))
        {
            _isTouched = false;
        }
        if (Input.GetMouseButton(0))
        {
            _touchPosition = _mainCamera.ScreenToWorldPoint(Input.mousePosition);
        }
#else
        if (_isTouched)
        {
            _isTouched = false;
            for (int i = 0; i < Input.touchCount; i++)
            {
                if (Input.GetTouch(i).fingerId == _touchId)
                {
                    _activeTouch = Input.GetTouch(i);
                    _isTouched   = true;
                    break;
                }
            }
        }
        if (!_isTouched)
        {
            if (Input.touchCount > 0)
            {
                _activeTouch        = Input.GetTouch(0);
                _touchStartPosition = _mainCamera.ScreenToWorldPoint(_activeTouch.position);
                _touchId            = _activeTouch.fingerId;
                _inputId++;
                _isTouched = true;
            }
        }
#endif
        if (_isTouched)
        {
#if !UNITY_EDITOR
            _touchPosition = _mainCamera.ScreenToWorldPoint(_activeTouch.position);
#endif
            OnTouched?.Invoke(_inputId, _touchPosition);
        }
    }
Beispiel #5
0
 public void RaiseOnTouched(OnTouchedEventArgs args)
 {
     OnTouched?.Invoke(this, args);
 }
Beispiel #6
0
 public void Touched(IGrabber grabber)
 {
     OnTouched?.Invoke(grabber, this);
 }