FairyGUI.GComponent.IsAncestorOf C# (CSharp) Method

IsAncestorOf() public method

public IsAncestorOf ( GObject obj ) : bool
obj GObject
return bool
        public bool IsAncestorOf(GObject obj)
        {
            if (obj == null)
                return false;

            GComponent p = obj.parent;
            while (p != null)
            {
                if (p == this)
                    return true;

                p = p.parent;
            }
            return false;
        }

Usage Example

 static int IsAncestorOf(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GComponent obj  = (FairyGUI.GComponent)ToLua.CheckObject(L, 1, typeof(FairyGUI.GComponent));
         FairyGUI.GObject    arg0 = (FairyGUI.GObject)ToLua.CheckObject(L, 2, typeof(FairyGUI.GObject));
         bool o = obj.IsAncestorOf(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }