GetComponentsInChildren() public method

public GetComponentsInChildren ( Type t ) : UnityEngine.Component[]
t Type
return UnityEngine.Component[]
コード例 #1
0
    static int GetComponentsInChildren(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.Component   obj  = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L, 1);
                System.Type             arg0 = ToLua.CheckMonoType(L, 2);
                UnityEngine.Component[] o    = obj.GetComponentsInChildren(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.Component obj  = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L, 1);
                System.Type           arg0 = ToLua.CheckMonoType(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponentsInChildren"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #2
0
 static public int GetComponentsInChildren(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
             System.Type           a1;
             checkType(l, 2, out a1);
             var ret = self.GetComponentsInChildren(a1);
             pushValue(l, ret);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
             System.Type           a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetComponentsInChildren(a1, a2);
             pushValue(l, ret);
             return(1);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #3
0
    static int GetComponentsInChildren(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Component), typeof(System.Type)))
            {
                UnityEngine.Component   obj  = (UnityEngine.Component)ToLua.ToObject(L, 1);
                System.Type             arg0 = (System.Type)ToLua.ToObject(L, 2);
                UnityEngine.Component[] o    = obj.GetComponentsInChildren(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Component), typeof(System.Type), typeof(bool)))
            {
                UnityEngine.Component obj  = (UnityEngine.Component)ToLua.ToObject(L, 1);
                System.Type           arg0 = (System.Type)ToLua.ToObject(L, 2);
                bool arg1 = LuaDLL.lua_toboolean(L, 3);
                UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponentsInChildren"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #4
0
 static int QPYX_GetComponentsInChildren_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2)
         {
             UnityEngine.Component   QPYX_obj_YXQP  = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L_YXQP, 1);
             System.Type             QPYX_arg0_YXQP = ToLua.CheckMonoType(L_YXQP, 2);
             UnityEngine.Component[] QPYX_o_YXQP    = QPYX_obj_YXQP.GetComponentsInChildren(QPYX_arg0_YXQP);
             ToLua.Push(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             UnityEngine.Component QPYX_obj_YXQP  = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L_YXQP, 1);
             System.Type           QPYX_arg0_YXQP = ToLua.CheckMonoType(L_YXQP, 2);
             bool QPYX_arg1_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 3);
             UnityEngine.Component[] QPYX_o_YXQP = QPYX_obj_YXQP.GetComponentsInChildren(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.Push(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.Component.GetComponentsInChildren"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #5
0
 static public int GetComponentsInChildren(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
             System.Type           a1;
             checkType(l, 2, out a1);
             var ret = self.GetComponentsInChildren(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
             System.Type           a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetComponentsInChildren(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function GetComponentsInChildren to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #6
0
 public static void SetSortingLayerRecursive(this UnityEngine.Component obj, string sortingLayer)
 {
     if (obj.TryGetComponent <Renderer>(out var renderer))
     {
         renderer.SetSortingLayerRecursive(sortingLayer);
     }
     else
     {
         foreach (var subrenderer in obj.GetComponentsInChildren <Renderer>())
         {
             subrenderer.SetSortingLayerRecursive(sortingLayer);
         }
     }
 }
コード例 #7
0
 static public int GetComponentsInChildren__Type(IntPtr l)
 {
     try {
         UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
         System.Type           a1;
         checkType(l, 2, out a1);
         var ret = self.GetComponentsInChildren(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #8
0
 /// <summary>
 /// 
 /// <para>
 /// Notify all IMaskable under the given component that they need to recalculate masking.
 /// </para>
 /// 
 /// </summary>
 /// <param name="mask"/>
 public static void NotifyStencilStateChanged(Component mask)
 {
   List<Component> list = ListPool<Component>.Get();
   mask.GetComponentsInChildren<Component>(list);
   for (int index = 0; index < list.Count; ++index)
   {
     if (!((Object) list[index] == (Object) null) && !((Object) list[index].gameObject == (Object) mask.gameObject))
     {
       IMaskable maskable = list[index] as IMaskable;
       if (maskable != null)
         maskable.RecalculateMasking();
     }
   }
   ListPool<Component>.Release(list);
 }
コード例 #9
0
ファイル: UIWriter.cs プロジェクト: swipswaps/FMVTools
 protected virtual void Awake()
 {
     text = GetComponent <Text>();
     Component[] attachedComponents = objectToWriteFrom.GetComponentsInChildren <Component>();
     foreach (Component component in attachedComponents)
     {
         BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
                              BindingFlags.Static | BindingFlags.Instance |
                              BindingFlags.DeclaredOnly;
         var currentFields = component.GetType().GetFields(flags);
         if (TryFindField(component, currentFields))
         {
             break;
         }
     }
 }
コード例 #10
0
 public static int GetComponentsInChildren_wrap(long L)
 {
     try
     {
         long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Component   obj  = get_obj(nThisPtr);
         System.Type             arg0 = FCGetObj.GetObj <System.Type>(FCLibHelper.fc_get_wrap_objptr(L, 0));
         UnityEngine.Component[] ret  = obj.GetComponentsInChildren(arg0);
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCCustomParam.ReturnArray(ret, ret_ptr);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
コード例 #11
0
        /// <summary>
        /// Extension method that retrieves the first component in a child of
        /// the given type and with the given name.
        /// </summary>
        /// <typeparam name="ComponentType">The type of component to look for.</typeparam>
        /// <param name="name">The name of the GameObject that the component is attached to.</param>
        /// <returns>The first component matching the criteria, or null.</returns>
        public static ComponentType GetComponentInChildrenByName <ComponentType> (this UnityEngine.Component obj, string name) where ComponentType : UnityEngine.Component
        {
            ComponentType[] hits = obj.GetComponentsInChildren <ComponentType>();

            // Stop here if nothing matched at all.
            if (hits.Length > 0)
            {
                foreach (ComponentType hit in hits)
                {
                    if (hit.name == name)
                    {
                        return(hit);
                    }
                }
            }

            return(null);
        }
コード例 #12
0
        public static T[] GetComponentsInChildrenExcludeSelf <T>(this Component component)
        {
            var childrenAndSelf = component.GetComponentsInChildren <T>();

            if (childrenAndSelf.Length == 0)
            {
                return(childrenAndSelf);
            }
            var hasT = component.GetComponent <T>();

            if (hasT == null)
            {
                return(childrenAndSelf);
            }

            var list = childrenAndSelf.ToList();

            list.RemoveAt(0);
            return(list.ToArray());
        }
コード例 #13
0
 public static Component[] GetComponentsInChildren2T(this UnityEngine.Component self, System.Boolean includeInactive, System.Type T)
 {
     return(self.GetComponentsInChildren(T, includeInactive));
 }
コード例 #14
0
 public static Component[] GetComponentsInChildren0T(this UnityEngine.Component self, System.Type T)
 {
     return(self.GetComponentsInChildren(T));
 }
コード例 #15
0
ファイル: MaskUtilities.cs プロジェクト: randomize/VimConfig
 public static void NotifyStencilStateChanged(Component mask)
 {
     List<Component> results = ListPool<Component>.Get();
     mask.GetComponentsInChildren<Component>(results);
     for (int i = 0; i < results.Count; i++)
     {
         if ((results[i] != null) && (results[i].gameObject != mask.gameObject))
         {
             IMaskable maskable = results[i] as IMaskable;
             if (maskable != null)
             {
                 maskable.RecalculateMasking();
             }
         }
     }
     ListPool<Component>.Release(results);
 }
コード例 #16
0
ファイル: ShopManager.cs プロジェクト: Xentrics/Praecapatus
            /**
             * empty slot constructor
             */
            public UIItem(Component itemElem)
            {
                Text TG = null, TK = null, TT = null, TN = null;
                foreach (Text t in itemElem.GetComponentsInChildren<Text>())
                {
                    if (t.name.Equals("Text_G"))
                        TG = t;
                    else if (t.name.Equals("Text_K"))
                        TK = t;
                    else if (t.name.Equals("Text_T"))
                        TT = t;
                    else if (t.name.Equals("Text_N"))
                        TN = t;
                }

                _itemElem = itemElem;
                _itemElemBorderImage = itemElem.GetComponent<Image>();
                _origColor = _itemElemBorderImage.color;
                _but = itemElem.GetComponent<Button>();
                _value = new UICurrency(TG, TK, TT, TN);
            }
コード例 #17
0
ファイル: Attributes.cs プロジェクト: paulmoore/UnJect
 public override object FindDependency(Component comp, FieldInfo field)
 {
     if (SearchParents) {
         comp = comp.transform.root;
     }
     if (IsContainerType(field)) {
         Type type;
         if (field.FieldType.IsArray) {
             type = field.FieldType.GetElementType();
         } else if (typeof(IList).IsAssignableFrom(field.FieldType)) {
             if (field.FieldType.GetGenericArguments().Length >= 1) {
                 type = field.FieldType.GetGenericArguments()[0];
             } else {
                 Debug.LogError(string.Format("{0} expected at least one generic argument from the type {1}, use List<T>", this, field.FieldType));
                 return null;
             }
         } else {
             Debug.LogError("Shouldn't be here");
             type = null;
         }
         if (Recursive) {
             return CreateArrayOrList(field, ConvertToGOArray(comp.GetComponentsInChildren(type, IncludeInactive)));
         }
         return CreateArrayOrList(field, ConvertToGOArray(comp.GetComponents(type)));
     }
     if (Recursive) {
         return comp.GetComponentInChildren(field.FieldType);
     }
     return comp.GetComponent(field.FieldType);
 }