protected override void OnDragDropRelease(GameObject surface) { var c = surface ? NGUITools.FindInParents<Container>(surface) : null; UIDragDropContainer container = surface ? NGUITools.FindInParents<UIDragDropContainer>(surface) : null; if(_container!=null){ _container.element=null; // _container=null; } if (c != null&&c.element==null){ c.element=this; _container=c; mTrans.parent=c.transform; Vector3 pos = mTrans.localPosition; pos.z = 0f; mTrans.localPosition = pos; }else if (container != null){ _container=null; mTrans.parent = (container.reparentTarget != null) ? container.reparentTarget : container.transform; Vector3 pos = mTrans.localPosition; pos.z = 0f; mTrans.localPosition = pos; }else { mTrans.parent = mParent; if(_container!=null)_container.element=this; } }
Container[] filter(Container[] arr) { var list=new List<Container>(); foreach(var e in arr){ if(e.element==null)list.Add(e); } return list.ToArray(); }