Esempio n. 1
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "UIManager");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "UIManager");
                LuaDLL.lua_getglobal(L, "UIManager");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaUIManager.MakeInstance, "MakeInstance");
            LuaDLL.lua_pushstdcallcfunction(L, LuaUIManager.OpenView, "OpenView");
            LuaDLL.lua_pushstdcallcfunction(L, LuaUIManager.CloseView, "CloseView");

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UIManager));
        }
Esempio n. 2
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Component");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Component");
                LuaDLL.lua_getglobal(L, "Component");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.New, "New");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponent, "GetComponent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponentInChildren, "GetComponentInChildren");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponentsInChildren, "GetComponentsInChildren");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponentInParent, "GetComponentInParent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponentsInParent, "GetComponentsInParent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.GetComponents, "GetComponents");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.CompareTag, "CompareTag");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.SendMessageUpwards, "SendMessageUpwards");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.SendMessage, "SendMessage");
            LuaDLL.lua_pushstdcallcfunction(L, LuaComponent.BroadcastMessage, "BroadcastMessage");
            LuaDLL.lua_pushcsharpproperty(L, "transform", LuaComponent.get_transform, null);
            LuaDLL.lua_pushcsharpproperty(L, "gameObject", LuaComponent.get_gameObject, null);
            LuaDLL.lua_pushcsharpproperty(L, "tag", LuaComponent.get_tag, LuaComponent.set_tag);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "Object");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Object");
                LuaDLL.lua_getglobal(L, "Object");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.Component));
        }
Esempio n. 3
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "UIButton");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "UIButton");
                LuaDLL.lua_getglobal(L, "UIButton");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaUIButton.SetState, "SetState");
            LuaDLL.lua_pushcsharpproperty(L, "isEnabled", LuaUIButton.get_isEnabled, LuaUIButton.set_isEnabled);
            LuaDLL.lua_pushcsharpproperty(L, "normalSprite", LuaUIButton.get_normalSprite, LuaUIButton.set_normalSprite);
            LuaDLL.lua_pushcsharpproperty(L, "normalSprite2D", LuaUIButton.get_normalSprite2D, LuaUIButton.set_normalSprite2D);
            LuaDLL.lua_pushcsharpproperty(L, "current", LuaUIButton.get_current, LuaUIButton.set_current);
            LuaDLL.lua_pushcsharpproperty(L, "dragHighlight", LuaUIButton.get_dragHighlight, LuaUIButton.set_dragHighlight);
            LuaDLL.lua_pushcsharpproperty(L, "hoverSprite", LuaUIButton.get_hoverSprite, LuaUIButton.set_hoverSprite);
            LuaDLL.lua_pushcsharpproperty(L, "pressedSprite", LuaUIButton.get_pressedSprite, LuaUIButton.set_pressedSprite);
            LuaDLL.lua_pushcsharpproperty(L, "disabledSprite", LuaUIButton.get_disabledSprite, LuaUIButton.set_disabledSprite);
            LuaDLL.lua_pushcsharpproperty(L, "hoverSprite2D", LuaUIButton.get_hoverSprite2D, LuaUIButton.set_hoverSprite2D);
            LuaDLL.lua_pushcsharpproperty(L, "pressedSprite2D", LuaUIButton.get_pressedSprite2D, LuaUIButton.set_pressedSprite2D);
            LuaDLL.lua_pushcsharpproperty(L, "disabledSprite2D", LuaUIButton.get_disabledSprite2D, LuaUIButton.set_disabledSprite2D);
            LuaDLL.lua_pushcsharpproperty(L, "pixelSnap", LuaUIButton.get_pixelSnap, LuaUIButton.set_pixelSnap);
            LuaDLL.lua_pushcsharpproperty(L, "onClick", LuaUIButton.get_onClick, LuaUIButton.set_onClick);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "UIButtonColor");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "UIButtonColor");
                LuaDLL.lua_getglobal(L, "UIButtonColor");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UIButton));
        }
Esempio n. 4
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "MonoBehaviour");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "MonoBehaviour");
                LuaDLL.lua_getglobal(L, "MonoBehaviour");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.Invoke, "Invoke");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.InvokeRepeating, "InvokeRepeating");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.CancelInvoke, "CancelInvoke");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.IsInvoking, "IsInvoking");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.StartCoroutine, "StartCoroutine");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.StartCoroutine_Auto, "StartCoroutine_Auto");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.StopCoroutine, "StopCoroutine");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.StopAllCoroutines, "StopAllCoroutines");
            LuaDLL.lua_pushstdcallcfunction(L, LuaMonoBehaviour.print, "print");
            LuaDLL.lua_pushcsharpproperty(L, "useGUILayout", LuaMonoBehaviour.get_useGUILayout, LuaMonoBehaviour.set_useGUILayout);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "Behaviour");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Behaviour");
                LuaDLL.lua_getglobal(L, "Behaviour");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.MonoBehaviour));
        }
Esempio n. 5
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Director");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Director");
                LuaDLL.lua_getglobal(L, "Director");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaDirector.GetInstance, "GetInstance");
            LuaDLL.lua_pushstdcallcfunction(L, LuaDirector.LogTest, "LogTest");
            LuaDLL.lua_pushcsharpproperty(L, "value", LuaDirector.get_value, LuaDirector.set_value);
            LuaDLL.lua_pushcsharpproperty(L, "luaState", LuaDirector.get_luaState, null);
            LuaDLL.lua_pushcsharpproperty(L, "scheduler", LuaDirector.get_scheduler, null);
            LuaDLL.lua_pushcsharpproperty(L, "uiManager", LuaDirector.get_uiManager, null);
            LuaDLL.lua_pushcsharpproperty(L, "eventDispatcher", LuaDirector.get_eventDispatcher, null);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "MonoBehaviour");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "MonoBehaviour");
                LuaDLL.lua_getglobal(L, "MonoBehaviour");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(Director));
        }
Esempio n. 6
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Scheduler");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Scheduler");
                LuaDLL.lua_getglobal(L, "Scheduler");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaScheduler.MakeInstance, "MakeInstance");
            LuaDLL.lua_pushstdcallcfunction(L, LuaScheduler.SchedulerCSFun, "SchedulerCSFun");
            LuaDLL.lua_pushstdcallcfunction(L, LuaScheduler.UnSchedulerCSFun, "UnSchedulerCSFun");
            LuaDLL.lua_pushstdcallcfunction(L, LuaScheduler.SetTimeOut, "SetTimeOut");
            LuaDLL.lua_pushstdcallcfunction(L, LuaScheduler.ExecuteCoroutine, "ExecuteCoroutine");

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "MonoBehaviour");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "MonoBehaviour");
                LuaDLL.lua_getglobal(L, "MonoBehaviour");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(Scheduler));
        }
Esempio n. 7
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Object");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Object");
                LuaDLL.lua_getglobal(L, "Object");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.New, "New");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.Destroy, "Destroy");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.DestroyImmediate, "DestroyImmediate");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.FindObjectsOfType, "FindObjectsOfType");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.DontDestroyOnLoad, "DontDestroyOnLoad");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.DestroyObject, "DestroyObject");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.ToString, "ToString");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.Equals, "Equals");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.GetHashCode, "GetHashCode");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.GetInstanceID, "GetInstanceID");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.Instantiate, "Instantiate");
            LuaDLL.lua_pushstdcallcfunction(L, LuaObject.FindObjectOfType, "FindObjectOfType");
            LuaDLL.lua_pushcsharpproperty(L, "name", LuaObject.get_name, LuaObject.set_name);
            LuaDLL.lua_pushcsharpproperty(L, "hideFlags", LuaObject.get_hideFlags, LuaObject.set_hideFlags);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.Object));
        }
Esempio n. 8
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Resources");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Resources");
                LuaDLL.lua_getglobal(L, "Resources");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.New, "New");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.FindObjectsOfTypeAll, "FindObjectsOfTypeAll");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.Load, "Load");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.LoadAsync, "LoadAsync");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.LoadAll, "LoadAll");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.GetBuiltinResource, "GetBuiltinResource");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.UnloadAsset, "UnloadAsset");
            LuaDLL.lua_pushstdcallcfunction(L, LuaResources.UnloadUnusedAssets, "UnloadUnusedAssets");

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.Resources));
        }
Esempio n. 9
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "GameObject");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "GameObject");
                LuaDLL.lua_getglobal(L, "GameObject");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.New, "New");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.CreatePrimitive, "CreatePrimitive");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponent, "GetComponent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponentInChildren, "GetComponentInChildren");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponentInParent, "GetComponentInParent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponents, "GetComponents");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponentsInChildren, "GetComponentsInChildren");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.GetComponentsInParent, "GetComponentsInParent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.SetActive, "SetActive");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.CompareTag, "CompareTag");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.FindGameObjectWithTag, "FindGameObjectWithTag");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.FindWithTag, "FindWithTag");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.FindGameObjectsWithTag, "FindGameObjectsWithTag");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.SendMessageUpwards, "SendMessageUpwards");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.SendMessage, "SendMessage");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.BroadcastMessage, "BroadcastMessage");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.AddComponent, "AddComponent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaGameObject.Find, "Find");
            LuaDLL.lua_pushcsharpproperty(L, "transform", LuaGameObject.get_transform, null);
            LuaDLL.lua_pushcsharpproperty(L, "layer", LuaGameObject.get_layer, LuaGameObject.set_layer);
            LuaDLL.lua_pushcsharpproperty(L, "activeSelf", LuaGameObject.get_activeSelf, null);
            LuaDLL.lua_pushcsharpproperty(L, "activeInHierarchy", LuaGameObject.get_activeInHierarchy, null);
            LuaDLL.lua_pushcsharpproperty(L, "isStatic", LuaGameObject.get_isStatic, LuaGameObject.set_isStatic);
            LuaDLL.lua_pushcsharpproperty(L, "tag", LuaGameObject.get_tag, LuaGameObject.set_tag);
            LuaDLL.lua_pushcsharpproperty(L, "gameObject", LuaGameObject.get_gameObject, null);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "Object");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Object");
                LuaDLL.lua_getglobal(L, "Object");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.GameObject));
        }
Esempio n. 10
0
        public static void Register(IntPtr L)
        {
            int oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "Transform");

            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Transform");
                LuaDLL.lua_getglobal(L, "Transform");
            }

            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.SetParent, "SetParent");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.Translate, "Translate");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.Rotate, "Rotate");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.RotateAround, "RotateAround");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.LookAt, "LookAt");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.TransformDirection, "TransformDirection");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.InverseTransformDirection, "InverseTransformDirection");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.TransformVector, "TransformVector");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.InverseTransformVector, "InverseTransformVector");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.TransformPoint, "TransformPoint");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.InverseTransformPoint, "InverseTransformPoint");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.DetachChildren, "DetachChildren");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.SetAsFirstSibling, "SetAsFirstSibling");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.SetAsLastSibling, "SetAsLastSibling");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.SetSiblingIndex, "SetSiblingIndex");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.GetSiblingIndex, "GetSiblingIndex");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.Find, "Find");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.IsChildOf, "IsChildOf");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.FindChild, "FindChild");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.GetEnumerator, "GetEnumerator");
            LuaDLL.lua_pushstdcallcfunction(L, LuaTransform.GetChild, "GetChild");
            LuaDLL.lua_pushcsharpproperty(L, "position", LuaTransform.get_position, LuaTransform.set_position);
            LuaDLL.lua_pushcsharpproperty(L, "localPosition", LuaTransform.get_localPosition, LuaTransform.set_localPosition);
            LuaDLL.lua_pushcsharpproperty(L, "eulerAngles", LuaTransform.get_eulerAngles, LuaTransform.set_eulerAngles);
            LuaDLL.lua_pushcsharpproperty(L, "localEulerAngles", LuaTransform.get_localEulerAngles, LuaTransform.set_localEulerAngles);
            LuaDLL.lua_pushcsharpproperty(L, "right", LuaTransform.get_right, LuaTransform.set_right);
            LuaDLL.lua_pushcsharpproperty(L, "up", LuaTransform.get_up, LuaTransform.set_up);
            LuaDLL.lua_pushcsharpproperty(L, "forward", LuaTransform.get_forward, LuaTransform.set_forward);
            LuaDLL.lua_pushcsharpproperty(L, "rotation", LuaTransform.get_rotation, LuaTransform.set_rotation);
            LuaDLL.lua_pushcsharpproperty(L, "localRotation", LuaTransform.get_localRotation, LuaTransform.set_localRotation);
            LuaDLL.lua_pushcsharpproperty(L, "localScale", LuaTransform.get_localScale, LuaTransform.set_localScale);
            LuaDLL.lua_pushcsharpproperty(L, "parent", LuaTransform.get_parent, LuaTransform.set_parent);
            LuaDLL.lua_pushcsharpproperty(L, "worldToLocalMatrix", LuaTransform.get_worldToLocalMatrix, null);
            LuaDLL.lua_pushcsharpproperty(L, "localToWorldMatrix", LuaTransform.get_localToWorldMatrix, null);
            LuaDLL.lua_pushcsharpproperty(L, "root", LuaTransform.get_root, null);
            LuaDLL.lua_pushcsharpproperty(L, "childCount", LuaTransform.get_childCount, null);
            LuaDLL.lua_pushcsharpproperty(L, "lossyScale", LuaTransform.get_lossyScale, null);
            LuaDLL.lua_pushcsharpproperty(L, "hasChanged", LuaTransform.get_hasChanged, LuaTransform.set_hasChanged);

            LuaDLL.lua_getglobal(L, "readIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__index");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_getglobal(L, "writeIndex");
            LuaDLL.lua_pushvalue(L, -1);
            LuaDLL.lua_setfield(L, -3, "__newindex");
            LuaDLL.lua_pop(L, 1);

            LuaDLL.lua_pushstdcallcfunction(L, new LuaCSFunction(LuaStatic.GameObjectGC));
            LuaDLL.lua_setfield(L, -2, "__gc");
            LuaDLL.lua_getglobal(L, "Component");
            if (LuaDLL.lua_isnil(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                LuaDLL.lua_newtable(L);
                LuaDLL.lua_setglobal(L, "Component");
                LuaDLL.lua_getglobal(L, "Component");
                LuaDLL.lua_setmetatable(L, -2);
            }
            else
            {
                LuaDLL.lua_setmetatable(L, -2);
            }

            LuaDLL.lua_settop(L, oldTop);
            LuaStatic.AddTypeDict(typeof(UnityEngine.Transform));
        }