/// <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);
        }
Example #2
0
        /// <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 = source.LocalToRoot(Vector2.zero, null);
            _agent.StartDrag(touchPointID);
        }