FairyGUI.Container.SetChildIndex C# (CSharp) Method

SetChildIndex() public method

public SetChildIndex ( DisplayObject child, int index ) : void
child DisplayObject
index int
return void
        public void SetChildIndex(DisplayObject child, int index)
        {
            int oldIndex = _children.IndexOf(child);
            if (oldIndex == index) return;
            if (oldIndex == -1) throw new ArgumentException("Not a child of this container");
            _children.RemoveAt(oldIndex);
            if (index >= _children.Count)
                _children.Add(child);
            else
                _children.Insert(index, child);
            InvalidateBatchingState(true);
        }

Usage Example

Example #1
0
 static int SetChildIndex(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.Container     obj  = (FairyGUI.Container)ToLua.CheckObject <FairyGUI.Container>(L, 1);
         FairyGUI.DisplayObject arg0 = (FairyGUI.DisplayObject)ToLua.CheckObject <FairyGUI.DisplayObject>(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.SetChildIndex(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
All Usage Examples Of FairyGUI.Container::SetChildIndex