コード例 #1
0
ファイル: KinectButton3D.cs プロジェクト: janchuvi/prototipo2
 public static void CancelClick()
 {
     if (active != null)
     {
         active.canceled   = true;
         active.isPressing = false;
         active            = null;
     }
 }
コード例 #2
0
ファイル: KinectButton3D.cs プロジェクト: janchuvi/prototipo2
    void ValidateEvents()
    {
        if (isHovering)
        {
            OnPersistentHovering();

            if (canceled)
            {
                return;
            }

            if (cursorState != CursorState.Up)
            {
                if (!isDragging)
                {
                    if (!wasHovering)
                    {
                        OnHoverEnter();

                        if (canceled)
                        {
                            return;
                        }
                    }
                    else
                    {
                        OnHoverStay();

                        if (canceled)
                        {
                            return;
                        }
                    }
                }

                if (cursorState == CursorState.Down)
                {
                    active     = this;
                    isPressing = true;
                }
            }
        }
        else if (wasHovering)
        {
            if (cursorState == CursorState.None)
            {
                OnNormal();

                if (canceled)
                {
                    return;
                }
            }

            OnHoverExit();

            if (canceled)
            {
                return;
            }
        }

        if (isPressing)
        {
            if (isDragging)
            {
                if (!wasDragging)
                {
                    OnDraggingStarted();

                    if (canceled)
                    {
                        return;
                    }
                }
                else if (!isHovering)
                {
                    OnOutsideDragging();

                    if (canceled)
                    {
                        return;
                    }
                }
                else
                {
                    OnDragging();

                    if (canceled)
                    {
                        return;
                    }
                }
            }

            if (isHovering)
            {
                if (cursorState == CursorState.Down)
                {
                    OnPreClick();

                    if (canceled)
                    {
                        return;
                    }
                }
                else if (cursorState == CursorState.Up)
                {
                    OnClick();

                    if (canceled)
                    {
                        return;
                    }
                }
            }
        }

        if (cursorState == CursorState.Up)
        {
            if (!isHovering && isPressing)
            {
                OnNormal();

                if (canceled)
                {
                    return;
                }
            }

            active     = null;
            isPressing = false;
        }

        wasHovering = isHovering;
        wasDragging = isDragging;
    }