Ejemplo n.º 1
0
        public static void DumpObject(UnityEngine.GameObject player)
        {
            UnityEngine.Component[] comps  = player.GetComponents <Component>();
            UnityEngine.Component[] Ccomps = player.GetComponentsInChildren <Component>();
            UnityEngine.Component[] Pcomps = player.GetComponentsInParent <Component>();
            foreach (var entry in comps)
            {
                WriteLine($"Name: {entry.name}");
                WriteLine($"\tType: {entry.GetType()}");
                WriteLine($"\tTag: {entry.tag}");
            }
            WriteLine($"--- {comps.Length} ---", true);

            foreach (var entry in Ccomps)
            {
                WriteLine($"Name: {entry.name}");
                WriteLine($"\tType: {entry.GetType()}");
                WriteLine($"\tTag: {entry.tag}");
            }
            WriteLine($"--- {Ccomps.Length} ---", true);

            foreach (var entry in Pcomps)
            {
                WriteLine($"Name: {entry.name}");
                WriteLine($"\tType: {entry.GetType()}");
                WriteLine($"\tTag: {entry.tag}");
            }
            WriteLine($"--- {Pcomps.Length} ---", true);
        }
    static int GetComponentsInParent(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.GameObject  obj  = (UnityEngine.GameObject)ToLua.CheckObject <UnityEngine.GameObject>(L, 1);
                System.Type             arg0 = ToLua.CheckMonoType(L, 2);
                UnityEngine.Component[] o    = obj.GetComponentsInParent(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.GameObject obj  = (UnityEngine.GameObject)ToLua.CheckObject <UnityEngine.GameObject>(L, 1);
                System.Type            arg0 = ToLua.CheckMonoType(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                UnityEngine.Component[] o = obj.GetComponentsInParent(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInParent"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 3
0
 static public int GetComponentsInParent(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             var ret = self.GetComponentsInParent(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetComponentsInParent(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int QPYX_GetComponentsInParent_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2)
         {
             UnityEngine.GameObject  QPYX_obj_YXQP  = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject));
             System.Type             QPYX_arg0_YXQP = ToLua.CheckMonoType(L_YXQP, 2);
             UnityEngine.Component[] QPYX_o_YXQP    = QPYX_obj_YXQP.GetComponentsInParent(QPYX_arg0_YXQP);
             ToLua.Push(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             UnityEngine.GameObject QPYX_obj_YXQP  = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject));
             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.GetComponentsInParent(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.GameObject.GetComponentsInParent"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Ejemplo n.º 5
0
    static int GetComponentsInParent(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(System.Type)))
            {
                UnityEngine.GameObject  obj  = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                System.Type             arg0 = (System.Type)ToLua.ToObject(L, 2);
                UnityEngine.Component[] o    = obj.GetComponentsInParent(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(System.Type), typeof(bool)))
            {
                UnityEngine.GameObject obj  = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                System.Type            arg0 = (System.Type)ToLua.ToObject(L, 2);
                bool arg1 = LuaDLL.lua_toboolean(L, 3);
                UnityEngine.Component[] o = obj.GetComponentsInParent(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInParent"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 6
0
 static public int GetComponentsInParent(IntPtr l)
 {
     try{
         if (matchType(l, 2, typeof(System.Type)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             UnityEngine.Component[] ret = self.GetComponentsInParent(a1);
             pushValue(l, ret);
             return(1);
         }
         else if (matchType(l, 2, typeof(System.Type), typeof(System.Boolean)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             UnityEngine.Component[] ret = self.GetComponentsInParent(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);
     }
 }
Ejemplo n.º 7
0
 static public int GetComponentsInParent(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.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             var ret = self.GetComponentsInParent(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Type            a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             var ret = self.GetComponentsInParent(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function GetComponentsInParent 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
 }
Ejemplo n.º 8
0
 static public int GetComponentsInParent__Type(IntPtr l)
 {
     try {
         UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
         System.Type            a1;
         checkType(l, 2, out a1);
         var ret = self.GetComponentsInParent(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 9
0
 public static int GetComponentsInParent_wrap(long L)
 {
     try
     {
         long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.GameObject  obj  = get_obj(nThisPtr);
         System.Type             arg0 = FCGetObj.GetObj <System.Type>(FCLibHelper.fc_get_wrap_objptr(L, 0));
         UnityEngine.Component[] ret  = obj.GetComponentsInParent(arg0);
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCCustomParam.ReturnArray(ret, ret_ptr);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Finds the root parent canvas of this GameObject. 
        /// </summary>
        /// <returns>The root canvas's GameObject. Returns null if no GameObject's with Canvas
        /// components are found or if the no Canvas is marked as the root canvas.</returns>
        private static GameObject FindRootCanvas(GameObject gameObject)
        {
            Canvas[] canvases = gameObject.GetComponentsInParent<Canvas>();

            if (canvases.Length == 0)
            {
                Debug.LogWarning("[DrawTextOnGUI] No Canvases currently loaded!");
                return null;
            }

            foreach (Canvas c in canvases)
                if (c.isRootCanvas)
                    return c.gameObject;

            Debug.LogWarningFormat("[DrawTextOnGUI] {0} Canvases, but no root Canvas found?", canvases.Length);
            return null;
        }
Ejemplo n.º 11
0
    static int GetComponentsInParent(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.GameObject.Register");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.GameObject  obj  = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                System.Type             arg0 = ToLua.CheckMonoType(L, 2);
                UnityEngine.Component[] o    = obj.GetComponentsInParent(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.GameObject obj  = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                System.Type            arg0 = ToLua.CheckMonoType(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                UnityEngine.Component[] o = obj.GetComponentsInParent(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInParent"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 12
0
 public static Component[] GetComponentsInParent0T(this UnityEngine.GameObject self, System.Type T)
 {
     return(self.GetComponentsInParent(T));
 }
 public Component[] GetComponentsInParent(Type t, [DefaultValue("false")] bool includeInactive)
 {
     return(gameObject.GetComponentsInParent(t, includeInactive));
 }
Ejemplo n.º 14
0
 public Component[] GetComponentsInParent(Type t, bool includeInactive = false)
 {
     return(gameObject.GetComponentsInParent(t, includeInactive));
 }
Ejemplo n.º 15
0
 public static Component[] GetComponentsInParent1T(this UnityEngine.GameObject self, System.Boolean includeInactive, System.Type T)
 {
     return(self.GetComponentsInParent(T, includeInactive));
 }
Ejemplo n.º 16
0
        public static int GetStencilID(GameObject obj)
        {
            int count = 0;

            m_maskComponents = obj.GetComponentsInParent<Mask>();
            for (int i = 0; i < m_maskComponents.Length; i++ )
            {
                if (m_maskComponents[i].MaskEnabled())
                    count += 1;
            }

            switch (count)
            {
                case 0:
                    return 0;
                case 1:
                    return 1;
                case 2:
                    return 3;
                case 3:
                    return 11;
            }

            return 0;
        }
Ejemplo n.º 17
0
        public static int GetStencilID(GameObject obj)
        {
            int count = 0;
          
            m_maskComponents = obj.GetComponentsInParent<Mask>();
            for (int i = 0; i < m_maskComponents.Length; i++ )
            {
#if UNITY_5_2 || UNITY_5_3
                //Debug.Log("Mask Enabled = " + m_maskComponents[i].enabled);
                if (m_maskComponents[i].IsActive())
                    count += 1;
#else
                if (m_maskComponents[i].MaskEnabled())
                    count += 1;
                #endif
            }

            //switch (count)
            //{
            //    case 0:
            //        return 0;
            //    case 1:
            //        return 1;
            //    case 2:
            //        return 3;
            //    case 3:
            //        return 7;
            //}

            //return 0;

            return Mathf.Min((1 << count) - 1, 255);

            }
Ejemplo n.º 18
0
        /// <summary>
        /// Function to get the Stencil ID
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static int GetStencilID(GameObject obj)
        {
            int count = 0;

            var maskComponents = TMP_ListPool<Mask>.Get();

            obj.GetComponentsInParent<Mask>(false, maskComponents);
            for (int i = 0; i < maskComponents.Count; i++)
            {
            #if UNITY_5_2 || UNITY_5_3 || UNITY_5_4
                if (maskComponents[i].IsActive())
                    count += 1;
            #else
                if (maskComponents[i].MaskEnabled())
                    count += 1;
            #endif
            }

            TMP_ListPool<Mask>.Release(maskComponents);

            return Mathf.Min((1 << count) - 1, 255);
        }
Ejemplo n.º 19
0
        public static int GetStencilID(GameObject obj)
        {
            int count = 0;

            m_maskComponents = obj.GetComponentsInParent<Mask>();
            for (int i = 0; i < m_maskComponents.Length; i++ )
            {
            #if UNITY_5_2 || UNITY_5_3 || UNITY_5_4
                //Debug.Log("Mask Enabled = " + m_maskComponents[i].enabled);
                if (m_maskComponents[i].IsActive())
                    count += 1;
            #else
                if (m_maskComponents[i].MaskEnabled())
                    count += 1;
                #endif
            }

            return Mathf.Min((1 << count) - 1, 255);
        }