Exemplo n.º 1
0
        /// <summary>
        /// Handler invoked on mouse click (left) event.
        /// </summary>
        /// <param name="x">X coordinate.</param>
        /// <param name="y">Y coordinate.</param>
        /// <param name="down">If set to <c>true</c> mouse button is down.</param>
        protected override void OnMouseClickedLeft(int x, int y, bool down)
        {
            if (null == m_Target)
            {
                return;
            }

            if (down)
            {
                m_Held    = true;
                m_HoldPos = m_Target.CanvasPosToLocal(new Point(x, y));
                InputHandler.MouseFocus = this;

                //gl_begin
                if (BeginDrag != null)
                {
                    BeginDrag.Invoke(this, EventArgs.Empty);
                }
                //gl_end
            }
            else
            {
                m_Held = false;

                InputHandler.MouseFocus = null;

                //gl_begin
                if (EndDrag != null)
                {
                    EndDrag.Invoke(this, EventArgs.Empty);
                }
                //gl_end
            }
        }
Exemplo n.º 2
0
 public void OnBeginDrag(BaseEventData eventData)
 {
     if (!(eventData is PointerEventData))
     {
         return;
     }
     BeginDrag?.Invoke(gameObject);
 }
Exemplo n.º 3
0
        public override void Update(VrUpdateArgs args)
        {
            var session = args.Session;
            var input   = session.SemanticInput();

            Matrix4 pointer   = PointerFilter(session.RightController.PointerTransform);
            var     hitResult = GetClosestHit(pointer.Translation);

            //KNARK: Review Deletebutton usage (used to capture on down, execute on up)

            /*if(input.SelectClick || input.DeleteClick)
             * {
             *  _pressedAt = pointer;
             * }
             * else */if (input.IsSelectPressed && !_dragging)
            {
                _dragging  = true;
                _hitResult = hitResult;

                var eventArgs = new VrEventArgs(pointer, _hitResult);
                BeginDrag?.Invoke(eventArgs);
                if (eventArgs.CreatedObject != null)
                {
                    _hitResult = eventArgs.CreatedObject();
                }
            }
            else if (_dragging && input.IsSelectPressed)
            {
                DeltaDrag?.Invoke(new VrEventArgs(pointer, _hitResult));
            }
            else if (!input.IsSelectPressed && _dragging)
            {
                _dragging = false;
                EndDrag?.Invoke(new VrEventArgs(pointer, _hitResult));
            }
            //else if (_gripPressed && !session.RightController.InputState.GripPressed
            //    && CloseEnough(_pressedAt, pointer))
            else if (input.DeleteClick)
            {
                AlternateClick?.Invoke(new VrEventArgs(pointer, hitResult));
            }
            else if (hitResult != null)
            {
                HoverObject?.Invoke(new VrEventArgs(pointer, hitResult));
            }
        }
Exemplo n.º 4
0
        public void OnBeginDrag(PointerEventData pointer)
        {
            if (Relic.IsEmpty)
            {
                pointer.pointerDrag = null;
                return;
            }

            this.isDragging = true;

            Tooltip.Instance.Hide();

            this.canvasGroup.blocksRaycasts = false;
            this.canvasGroup.interactable   = false;

            this.rectTransform.SetParent(this.dragTransform);
            this.rectTransform.sizeDelta = new Vector2(64, 64);

            CursorManager.Instance.ChangeState(CursorManager.CursorState.None);
            AudioManager.Instance.PlayItemPick();
            BeginDrag?.Invoke(this);
        }
Exemplo n.º 5
0
        public void OnBeginDrag(PointerEventData pointer)
        {
            if (Item.IsEmpty || IsBlocked || !IsDraggable || pointer.button == PointerEventData.InputButton.Right)
            {
                pointer.pointerDrag = null;
                return;
            }

            ItemTooltip.Instance.Hide();

            this.canvasGroup.blocksRaycasts = false;
            this.canvasGroup.interactable   = false;

            this.rectTransform.SetParent(this.dragTransform);
            this.rectTransform.sizeDelta = new Vector2(64, 64);

            CursorManager.Instance.ChangeState(CursorManager.CursorState.None);
            AudioManager.Instance.PlayItemPick(Item);

            BeginDrag?.Invoke(this);
            AnyBeginDrag?.Invoke(this);
        }
Exemplo n.º 6
0
 public override void OnBeginDrag(PointerEventData eventData)
 {
     BeginDrag?.Invoke();
 }
Exemplo n.º 7
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     BeginDrag?.Invoke(eventData);
 }