/// <summary> /// Start dragging. /// 开始拖动。 /// </summary> /// <param name="source">Source object. This is the object which initiated the dragging.</param> /// <param name="icon">Icon to be used as the dragging sign.</param> /// <param name="sourceData">Custom data. You can get it in the onDrop event data.</param> /// <param name="touchPointID">Copy the touchId from InputEvent to here, if has one.</param> public void StartDrag(GObject source, string icon, object sourceData, int touchPointID = -1) { if (_agent.parent != null) { return; } _sourceData = sourceData; _agent.url = icon; GRoot.inst.AddChild(_agent); _agent.xy = GRoot.inst.GlobalToLocal(Stage.inst.GetTouchPosition(touchPointID)); _agent.StartDrag(touchPointID); }
public void StartDrag(GObject source, string icon, object sourceData, int touchPointID = -1) { if (_agent.parent != null) { return; } _sourceData = sourceData; _agent.url = icon; GRoot.inst.AddChild(_agent); Vector2 pt = source.LocalToGlobal(new Vector2(0, 0)); _agent.SetXY(pt.x, pt.y); _agent.StartDrag(null, touchPointID); }