Skip to main content

DragDropManager

Namespace:FairyGUI
Source:Assets/Scripts/UI/DragDropManager.cs (line 12)

public class DragDropManager

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

Constructors​

DragDropManager()​

public DragDropManager();

Source:UI/DragDropManager.cs (line 36)

Methods​

Cancel()​

public void Cancel();

Cancel dragging. 取消拖动。

Source:UI/DragDropManager.cs (line 94)

StartDrag(GObject, string, object, int)​

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

Start dragging. 开始拖动。

ParameterTypeDescription
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.

Source:UI/DragDropManager.cs (line 77)

Properties​

dragAgent​

public GLoader dragAgent { get; }

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

Source:UI/DragDropManager.cs (line 55)

dragging​

public bool dragging { get; }

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

Source:UI/DragDropManager.cs (line 64)

inst​

public static DragDropManager inst { get; }

Source:UI/DragDropManager.cs (line 19)