using UnityEngine;
using System.Collections;
public class XXUIDragDropItem : UIDragDropItem {
override protected void OnDragDropRelease (GameObject surface)
{
if (!cloneOnDrag)
{
mTouchID = int.MinValue;
// Re-enable the collider
if (mButton != null) mButton.isEnabled = true;
else if (mCollider != null) mCollider.enabled = true;
// Is there a droppable container?
UIDragDropContainer container = surface ? NGUITools.FindInParents<UIDragDropContainer>(surface) : null;
if (container != null)
{
// Container found -- parent this object to the container
mTrans.parent = (container.reparentTarget != null) ? container.reparentTarget : container.transform;
Vector3 pos = mTrans.localPosition;
pos.z = 0f;
mTrans.localPosition = pos;
}
else
{
// No valid container under the mouse -- revert the item's parent
mTrans.parent = mParent;
}
// Update the grid and table references
mParent = mTrans.parent;
mGrid = NGUITools.FindInParents<UIGrid>(mParent);
mTable = NGUITools.FindInParents<UITable>(mParent);
// Re-enable the drag scroll view script
if (mDragScrollView != null)
/*XX* mDragScrollView.enabled = true; */
/*XX*/ StartCoroutine(this.activateScrollViewLater());
// Notify the widgets that the parent has changed
NGUITools.MarkParentAsChanged(gameObject);
if (mTable != null) mTable.repositionNow = true;
if (mGrid != null) mGrid.repositionNow = true;
}
else NGUITools.Destroy(gameObject);
}
/*XX ADD****************************/
IEnumerator activateScrollViewLater() {
yield return new WaitForEndOfFrame
(); mDragScrollView.enabled = true;
}
/*XX ADD END************************/
}