跳到主要内容

DragDropManager

命名空间:FairyGUI
源码:Assets/Scripts/UI/DragDropManager.cs (行 12)

public class DragDropManager

Helper for drag and drop. 这是一个提供特殊拖放功能的功能类。与GObject.draggable不同,拖动开始后,他使用一个替代的图标作为拖动对象。 当玩家释放鼠标/手指,目标组件会发出一个onDrop事件。

构造函数​

DragDropManager()​

public DragDropManager();

源码:UI/DragDropManager.cs (行 36)

方法​

Cancel()​

public void Cancel();

Cancel dragging. 取消拖动。

源码:UI/DragDropManager.cs (行 94)

StartDrag(GObject, string, object, int)​

public void StartDrag(GObject source, string icon, object sourceData, int touchPointID = -1);

Start dragging. 开始拖动。

参数类型说明
sourceGObjectSource object. This is the object which initiated the dragging.
iconstringIcon to be used as the dragging sign.
sourceDataobjectCustom data. You can get it in the onDrop event data.
touchPointIDintCopy the touchId from InputEvent to here, if has one.

源码:UI/DragDropManager.cs (行 77)

属性​

dragAgent​

public GLoader dragAgent { get; }

Loader object for real dragging. 用于实际拖动的Loader对象。你可以根据实际情况设置loader的大小,对齐等。

源码:UI/DragDropManager.cs (行 55)

dragging​

public bool dragging { get; }

Is dragging? 返回当前是否正在拖动。

源码:UI/DragDropManager.cs (行 64)

inst​

public static DragDropManager inst { get; }

源码:UI/DragDropManager.cs (行 19)