FairyGUI.GComponent.ChildSortingOrderChanged C# (CSharp) Method

ChildSortingOrderChanged() private method

private ChildSortingOrderChanged ( GObject child, int oldValue, int newValue ) : void
child GObject
oldValue int
newValue int
return void
        internal void ChildSortingOrderChanged(GObject child, int oldValue, int newValue)
        {
            if (newValue == 0)
            {
                _sortingChildCount--;
                SetChildIndex(child, _children.Count);
            }
            else
            {
                if (oldValue == 0)
                    _sortingChildCount++;

                int oldIndex = _children.IndexOf(child);
                int index = GetInsertPosForSortingChild(child);
                if (oldIndex < index)
                    _SetChildIndex(child, oldIndex, index - 1);
                else
                    _SetChildIndex(child, oldIndex, index);
            }
        }