本文整理汇总了C#中OTObject.HandleDrag方法的典型用法代码示例。如果您正苦于以下问题:C# OTObject.HandleDrag方法的具体用法?C# OTObject.HandleDrag怎么用?C# OTObject.HandleDrag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTObject
的用法示例。
在下文中一共展示了OTObject.HandleDrag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DragControl
void DragControl(OTObject dragObject)
{
if (!OTDragObject.Dragging(dragObject))
{
if (mobile)
{
if (touch.phase == TouchPhase.Began)
{
if (!multiDrag)
OTDragObject.Clear();
if (OTDragObject.ByFinger(touch.fingerId)==null)
OTDragObject.New(touch.fingerId).position = touch.position;
}
else
{
OTDragObject o = OTDragObject.ByFinger(touch.fingerId);
if (!o.dragging)
{
if (touch.phase == TouchPhase.Moved && o!=null)
{
o.dragging = true;
o.dragObject = dragObject;
dragObject.HandleDrag("start", null);
dragObject.dragTouch = touch;
Drag(o,touch.position);
}
}
}
}
else
{
if (!maybeDrag && Input.GetMouseButton(dragObject.dragButton))
{
dragPosition = Input.mousePosition;
maybeDrag = true;
maybeButton = dragObject.dragButton;
}
else
if (Input.GetMouseButton(dragObject.dragButton) && !((Vector2)Input.mousePosition).Equals(dragPosition))
{
OTDragObject o = OTDragObject.New(dragObject);
o.dragging = true;
o.position = dragPosition;
maybeDrag = false;
dragObject.HandleDrag("start", null);
Drag(o, Input.mousePosition);
}
}
}
else
{
// find touch
OTDragObject o = OTDragObject.ByObject(dragObject);
if (OT.mobile)
{
if (o!=null)
{
if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
{
dragObject.HandleDrag("end", null);
OTDragObject.Remove(o);
}
else
{
dragObject.dragTouch = touch;
Drag(o, touch.position);
}
}
}
else
{
if (!Input.GetMouseButton(dragObject.dragButton))
{
dragObject.HandleDrag("end", null);
OTDragObject.Remove(o);
}
else
Drag(o, Input.mousePosition);
}
}
}