コード例 #1
0
 public AnimationWindowManipulator()
 {
     // NoOps...
     onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { return(false); };
     onDrag      += (AnimationWindowManipulator manipulator, Event evt) => { return(false); };
     onEndDrag   += (AnimationWindowManipulator manipulator, Event evt) => { return(false); };
 }
コード例 #2
0
ファイル: TouchHandler.cs プロジェクト: joyhooei/GameDemos
 public void RemoveDragListener(OnDragDelegate del)
 {
     if (m_drag_delegate != null)
     {
         m_drag_delegate -= del;
     }
     TouchController.Instance.RegisterOnDrag(mCollider, m_drag_delegate);
 }
コード例 #3
0
ファイル: BallScrollerView.cs プロジェクト: ishidafuu/dmui
 public void Init(CellViewInstantiated cellViewInstantiated,
                  OnDragDelegate scrollerDrag,
                  OnBeginDragDelegate scrollerBeginDrag,
                  OnEndDragDelegate scrollerEndDrag)
 {
     m_Scroller.Delegate             = this;
     m_Scroller.cellViewInstantiated = cellViewInstantiated;
     m_Scroller.scrollerDrag         = scrollerDrag;
     m_Scroller.scrollerBeginDrag    = scrollerBeginDrag;
     m_Scroller.scrollerEndDrag      = scrollerEndDrag;
     LoadData();
 }
コード例 #4
0
ファイル: TouchHandler.cs プロジェクト: joyhooei/GameDemos
 public void AddDragListener(OnDragDelegate del)
 {
     if (m_drag_delegate == null)
     {
         m_drag_delegate = del;
     }
     else
     {
         m_drag_delegate += del;
     }
     TouchController.Instance.RegisterOnDrag(mCollider, m_drag_delegate);
 }
コード例 #5
0
 public void SetDragCallback(OnDragDelegate dragDelegate)
 {
     base.DragCallBack = dragDelegate;
 }
コード例 #6
0
    public void     drawButton(Vector2 nMousePos, Rect[] dropRects, OnDragDelegate onDrag, OnDropOnAreaDelegate onDrop, bool enabled)
    {
        currentRect.x      = originalRect.x;
        currentRect.y      = originalRect.y;
        currentRect.width  = originalRect.width;
        currentRect.height = originalRect.height;

        if (Event.current.type == EventType.MouseDown)
        {
            Rect area = originalRect;

            if (nMousePos.x > area.x && nMousePos.y > area.y &&
                nMousePos.x < (area.x + area.width) && nMousePos.y < (area.y + area.height)
                )
            {
                if (enabled)
                {
                    mouseState = EventType.MouseDown;
                }
                onDrag(this, enabled);
            }
        }
        else if (Event.current.type == EventType.MouseUp)
        {
            if (mouseState == EventType.MouseDown)
            {
                int index = -1;

                for (int i = 0; i < dropRects.Length; i++)
                {
                    Rect area = dropRects[i];

                    if (nMousePos.x > area.x && nMousePos.y > area.y &&
                        nMousePos.x < (area.x + area.width) && nMousePos.y < (area.y + area.height)
                        )
                    {
                        index = i;
                        break;
                    }
                }

                mouseState = EventType.MouseUp;
                onDrop(index);
            }
        }

        if (mouseState == EventType.MouseDown)
        {
            currentRect.x      = nMousePos.x - selectedRect.width * 0.5f;
            currentRect.y      = nMousePos.y - selectedRect.height * 0.5f;
            currentRect.width  = selectedRect.width;
            currentRect.height = selectedRect.height;
        }

        if (enabled)
        {
            GuiUtils.showImage(button, currentRect);
        }
        else
        {
            GuiUtils.showImage(disabled_button, currentRect);
        }
    }