FairyGUI.GComponent.RemoveChildAt C# (CSharp) Method

RemoveChildAt() public method

Removes a child at a certain index. Children above the child will move down.
public RemoveChildAt ( int index, bool dispose ) : GObject
index int Index
dispose bool If true, the child will be disposed right away.
return GObject
        public virtual GObject RemoveChildAt(int index, bool dispose)
        {
            if (index >= 0 && index < numChildren)
            {
                GObject child = _children[index];

                child.InternalSetParent(null);

                if (child.sortingOrder != 0)
                    _sortingChildCount--;

                _children.RemoveAt(index);
                if (child.inContainer)
                {
                    container.RemoveChild(child.displayObject);
                    if (_childrenRenderOrder == ChildrenRenderOrder.Arch)
                    {
                        UpdateContext.OnBegin -= _buildDelegate;
                        UpdateContext.OnBegin += _buildDelegate;
                    }
                }

                if (dispose)
                    child.Dispose();

                SetBoundsChangedFlag();

                return child;
            }
            else
                throw new Exception("Invalid child index: " + index + ">" + numChildren);
        }

Same methods

GComponent::RemoveChildAt ( int index ) : GObject

Usage Example

    static int RemoveChildAt(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GComponent), typeof(int)))
            {
                FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.ToObject(L, 1);
                int arg0           = (int)LuaDLL.lua_tonumber(L, 2);
                FairyGUI.GObject o = obj.RemoveChildAt(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GComponent), typeof(int), typeof(bool)))
            {
                FairyGUI.GComponent obj = (FairyGUI.GComponent)ToLua.ToObject(L, 1);
                int              arg0   = (int)LuaDLL.lua_tonumber(L, 2);
                bool             arg1   = LuaDLL.lua_toboolean(L, 3);
                FairyGUI.GObject o      = obj.RemoveChildAt(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GComponent.RemoveChildAt"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
All Usage Examples Of FairyGUI.GComponent::RemoveChildAt