Ejemplo n.º 1
0
 public static void DoBind(ClassBind cb)
 {
     if (_cbs != null && _cbs.Contains(cb))
     {
         return;
     }
     DoBind(new List <ClassBind> {
         cb
     });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get a class created by classbind on a gameObject's children
 /// 获取通过classbind给gameObject的子物体挂载的脚本对象
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObject"></param>
 /// <returns></returns>
 public static T GetHotClassInChildren <T>(this GameObject gameObject) where T : class
 {
     if (typeof(T) == typeof(Component) || typeof(T).IsSubclassOf(typeof(MonoBehaviour)))
     {
         return(gameObject.GetComponentInChildren <T>());
     }
     else
     {
         object result = ClassBind.GetHotComponentInChildren(gameObject, typeof(T).FullName);
         if (result == null)
         {
             return(null);
         }
         if (((T[])result).Length == 0)
         {
             return(null);
         }
         return(((T[])result)[0]);
     }
 }