Esempio n. 1
0
 /// <summary>
 /// Remove a JBehaviour
 /// </summary>
 /// <param name="jBehaviour"></param>
 public static void RemoveJBehaviour(JBehaviour jBehaviour)
 {
     if (Application.isEditor)
     {
         Tools.DestroyHotComponent(jBehaviour.gameObject, jBehaviour);
     }
     jBehaviour.Destroy();
 }
Esempio n. 2
0
 /// <summary>
 /// Remove a JBehaviour
 /// </summary>
 /// <param name="jBehaviour"></param>
 public static void RemoveJBehaviour(JBehaviour jBehaviour)
 {
     if (Application.isEditor)
     {
         UnityEngine.Object.Destroy(GetJBehaviourInEditor(jBehaviour));
     }
     jBehaviour.Destroy();
 }
Esempio n. 3
0
        /// <summary>
        /// Get a JBehaviour in Editor
        /// </summary>
        /// <param name="jBehaviour"></param>
        /// <returns></returns>
        private static MonoBehaviourAdapter.Adaptor GetJBehaviourInEditor(JBehaviour jBehaviour)
        {
            var f = typeof(JBehaviour).GetField("_instanceID", BindingFlags.NonPublic);

            return(jBehaviour._gameObject.GetComponents <MonoBehaviourAdapter.Adaptor>()
                   .ToList()
                   .Find(a =>
                         a.isJBehaviour &&
                         f?.GetValue(a.ILInstance).ToString() == jBehaviour._instanceID));
        }
Esempio n. 4
0
 /// <summary>
 /// Get a JUI on a gameObject
 /// 在gameObject上获取全部JUI
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObject"></param>
 /// <returns></returns>
 public static JUI[] GetJUIs(this GameObject gameObject)
 {
     return(JBehaviour.GetJBehaviours <JUI>(gameObject));
 }
Esempio n. 5
0
 /// <summary>
 /// Get a JUI on a gameObject
 /// 在gameObject上获取JUI
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObject"></param>
 /// <returns></returns>
 public static JUI GetJUI(this GameObject gameObject)
 {
     return(JBehaviour.GetJBehaviour <JUI>(gameObject));
 }
Esempio n. 6
0
 /// <summary>
 /// Create JUI on a gameObject
 /// 在gameObject上创建JUI
 /// </summary>
 /// <param name="gameObject"></param>
 /// <returns></returns>
 public static JUI CreateJUI(this GameObject gameObject)
 {
     return(JBehaviour.CreateOn <JUI>(gameObject, false));
 }
Esempio n. 7
0
 /// <summary>
 /// Get all JBehaviour on a gameObject
 /// 在gameObject上获取全部JBehaviour
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObject"></param>
 /// <returns></returns>
 public static T[] GetJBehaviours <T>(this GameObject gameObject) where T : JBehaviour
 {
     return(JBehaviour.GetJBehaviours <T>(gameObject));
 }
Esempio n. 8
0
 /// <summary>
 /// Create a JBehaviour on a gameObject
 /// 在gameobject上创建JBehaviour
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObject"></param>
 /// <param name="activeAfter"></param>
 /// <returns></returns>
 public static T CreateJBehaviour <T>(this GameObject gameObject, bool activeAfter = true) where T : JBehaviour
 {
     return(JBehaviour.CreateOn <T>(gameObject, activeAfter));
 }
Esempio n. 9
0
 /// <summary>
 /// Remove a JUI
 /// 销毁JUI
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="jBehaviour"></param>
 /// <returns></returns>
 public static void Remove(this JUI jUI)
 {
     JBehaviour.RemoveJBehaviour(jUI);
 }
Esempio n. 10
0
 /// <summary>
 /// Remove a JBehaviour
 /// 销毁JBehaviour
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="jBehaviour"></param>
 /// <returns></returns>
 public static void Remove(this JBehaviour jBehaviour)
 {
     JBehaviour.RemoveJBehaviour(jBehaviour);
 }