Base behaviour that has protected implementations of Unity lifecycle functions.

Inheritance: UnityEngine.MonoBehaviour
Exemple #1
0
 static public int IsActive(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
         UnityEngine.EventSystems.UIBehaviour self = (UnityEngine.EventSystems.UIBehaviour)checkSelf(l);
         var ret = self.IsActive();
         pushValue(l, true);
         pushValue(l, ret);
         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
 }
Exemple #2
0
    public static void SetVisible(this UnityEngine.EventSystems.UIBehaviour ui, bool visible)
    {
        if (ui == null)
        {
            return;
        }

        ui.gameObject.SetActive(visible);
    }
Exemple #3
0
    static int IsDestroyed(IntPtr L)
    {
        L.ChkArgsCount(1);
        UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)L.ChkUnityObjectSelf(1, "UnityEngine.EventSystems.UIBehaviour");
        bool o = obj.IsDestroyed();

        L.PushBoolean(o);
        return(1);
    }
    static int IsDestroyed(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.EventSystems.UIBehaviour");
        bool o = obj.IsDestroyed();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #5
0
 static public int IsActive(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.UIBehaviour self = (UnityEngine.EventSystems.UIBehaviour)checkSelf(l);
         var ret = self.IsActive();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #6
0
 static public int IsDestroyed(IntPtr l)
 {
     try{
         UnityEngine.EventSystems.UIBehaviour self = (UnityEngine.EventSystems.UIBehaviour)checkSelf(l);
         System.Boolean ret = self.IsDestroyed();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int QPYX_IsDestroyed_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.EventSystems.UIBehaviour QPYX_obj_YXQP = (UnityEngine.EventSystems.UIBehaviour)ToLua.CheckObject <UnityEngine.EventSystems.UIBehaviour>(L_YXQP, 1);
         bool QPYX_o_YXQP = QPYX_obj_YXQP.IsDestroyed();
         LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int IsDestroyed(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)ToLua.CheckObject <UnityEngine.EventSystems.UIBehaviour>(L, 1);
         bool o = obj.IsDestroyed();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #9
0
    static int IsDestroyed(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.EventSystems.UIBehaviour.IsDestroyed");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 1);
            UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)ToLua.CheckObject <UnityEngine.EventSystems.UIBehaviour>(L, 1);
            bool o = obj.IsDestroyed();
            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #10
0
        /// <summary>
        /// 实例化UIElement
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="uIView"></param>
        /// <param name="uIBehaviour"></param>
        /// <returns></returns>
        internal static T New <T>(UIView uIView, UnityEngine.EventSystems.UIBehaviour uIBehaviour) where T : UIElement
        {
            switch (uIBehaviour)
            {
            case Button button:
                return(new UIButton(uIView, button) as T);

            case Image image:
                return(new UIImage(uIView, image) as T);

            case TextPlus textPlus:
                return(new UITextPlus(uIView, textPlus) as T);

            case InputField inputField:
                return(new UIInputField(uIView, inputField) as T);

            case Text text:
                return(new UIText(uIView, text) as T);

            case Toggle toggle:
                return(new UIToggle(uIView, toggle) as T);

            case Slider slider:
                return(new UISlider(uIView, slider) as T);

            case Scrollbar scrollbar:
                return(new UIScrollbar(uIView, scrollbar) as T);

            case Dropdown dropdown:
                return(new UIDropdown(uIView, dropdown) as T);

            default:
                break;
            }
            return(null);
        }
Exemple #11
0
 private int OrderOnType(UIBehaviour item)
 {
     if (item is Button) return 0;
     if (item is Text) return 1;
     return 10;
 }
    void AddExample <TScriptClass>(string name, string controlName, bool useInWeb) where TScriptClass : MonoBehaviour
    {
        //	Button
        Button button = null;
        {
            if (m_MenuButtons == null ||
                m_MenuButtons.Length <= m_Examples.Count)
            {
                return;
            }

            string buttonName = "Button " + m_Examples.Count.ToString();
            foreach (Button b in m_MenuButtons)
            {
                if (string.Compare(b.gameObject.name, buttonName) == 0)
                {
                    button = b;
                    break;
                }
            }

            if (button == null)
            {
                return;
            }
        }


        //	Control
        GameObject controlGameObject = null;

        {
            GameObject goWorkPanel = GameObject.Find(sWorkPanel);
            if (goWorkPanel == null)
            {
                return;
            }

            UnityEngine.EventSystems.UIBehaviour[] uiBehaviours = goWorkPanel.GetComponentsInChildren <UnityEngine.EventSystems.UIBehaviour>();
            if (uiBehaviours == null)
            {
                return;
            }

            UnityEngine.EventSystems.UIBehaviour uiBehaviour = null;
            foreach (UnityEngine.EventSystems.UIBehaviour b in uiBehaviours)
            {
                if (string.Compare(b.gameObject.name, controlName) == 0)
                {
                    uiBehaviour = b;
                    break;
                }
            }

            if (uiBehaviour == null)
            {
                return;
            }

            controlGameObject = uiBehaviour.gameObject;
        }


        //
        controlGameObject.SetActive(false);

                #if UNITY_WEBPLAYER
        if (!useInWeb)
        {
            return;
        }
                #endif


        //
        button.gameObject.SetActive(true);

        Text text = button.GetComponentInChildren <Text>();
        text.fontSize = 13;
        text.text     = name;

        button.onClick.AddListener(() => OnMenuButtonClick(name));


        m_Examples.Add(name, new Example(
                           name,
                           button,
                           controlGameObject,
                           delegate(){ controlGameObject.AddComponent <TScriptClass>(); }));
    }