You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
using UnityEngine; |
|
using UnityEngine.Events; |
|
using UnityEngine.EventSystems; |
|
using System.Collections; |
|
|
|
namespace UIWidgets |
|
{ |
|
/// <summary> |
|
/// SlideBlock handle. |
|
/// </summary> |
|
public class SlideBlockHandle : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler { |
|
/// <summary> |
|
/// BeginDrag event. |
|
/// </summary> |
|
public PointerUnityEvent BeginDragEvent = new PointerUnityEvent(); |
|
|
|
/// <summary> |
|
/// EndDrag event. |
|
/// </summary> |
|
public PointerUnityEvent EndDragEvent = new PointerUnityEvent(); |
|
|
|
/// <summary> |
|
/// Drag event. |
|
/// </summary> |
|
public PointerUnityEvent DragEvent = new PointerUnityEvent(); |
|
|
|
/// <summary> |
|
/// Called by a BaseInputModule before a drag is started. |
|
/// </summary> |
|
/// <param name="eventData">Event data.</param> |
|
public void OnBeginDrag(PointerEventData eventData) |
|
{ |
|
BeginDragEvent.Invoke(eventData); |
|
} |
|
|
|
/// <summary> |
|
/// Called by a BaseInputModule when a drag is ended. |
|
/// </summary> |
|
/// <param name="eventData">Event data.</param> |
|
public void OnEndDrag(PointerEventData eventData) |
|
{ |
|
EndDragEvent.Invoke(eventData); |
|
} |
|
|
|
/// <summary> |
|
/// When draging is occuring this will be called every time the cursor is moved. |
|
/// </summary> |
|
/// <param name="eventData">Event data.</param> |
|
public void OnDrag(PointerEventData eventData) |
|
{ |
|
DragEvent.Invoke(eventData); |
|
} |
|
} |
|
} |