public AnimationWindowManipulator() { // NoOps... onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { return(false); }; onDrag += (AnimationWindowManipulator manipulator, Event evt) => { return(false); }; onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { return(false); }; }
public void RemoveDragListener(OnDragDelegate del) { if (m_drag_delegate != null) { m_drag_delegate -= del; } TouchController.Instance.RegisterOnDrag(mCollider, m_drag_delegate); }
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(); }
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); }
public void SetDragCallback(OnDragDelegate dragDelegate) { base.DragCallBack = dragDelegate; }
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); } }