private IEnumerator RefreshChildren()
        {
            //Handle new chilren
            for (int i = 0; i < _rect.childCount; i++)
            {
                if (_cachedChildren.Contains(_rect.GetChild(i)))
                    continue;

                //Get or Create ReorderableListElement
                _ele = _rect.GetChild(i).gameObject.GetComponent<ReorderableListElement>() ??
                       _rect.GetChild(i).gameObject.AddComponent<ReorderableListElement>();
                _ele.Init(_extList);

                _cachedChildren.Add(_rect.GetChild(i));
                _cachedListElement.Add(_ele);
            }

            //HACK a little hack, if I don't wait one frame I don't have the right deleted children
            yield return 0;

            //Remove deleted child
            for (int i = _cachedChildren.Count - 1; i >= 0; i--)
            {
                if (_cachedChildren[i] == null)
                {
                    _cachedChildren.RemoveAt(i);
                    _cachedListElement.RemoveAt(i);
                }
            }
        }
Esempio n. 2
0
 static public int Init(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ReorderableListElement self = (UnityEngine.UI.Extensions.ReorderableListElement)checkSelf(l);
         UnityEngine.UI.Extensions.ReorderableList        a1;
         checkType(l, 2, out a1);
         self.Init(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }