static int TestEvent(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            int __gen_param_count       = LuaAPI.lua_gettop(L);

            Tutorial.DrivenClass __cl_gen_to_be_invoked = (Tutorial.DrivenClass)translator.FastGetCSObj(L, 1);
            try {
                System.Action __gen_delegate = translator.GetDelegate <System.Action>(L, 3);
                if (__gen_delegate == null)
                {
                    return(LuaAPI.luaL_error(L, "#3 need System.Action!"));
                }

                if (__gen_param_count == 3)
                {
                    System.IntPtr strlen;

                    System.IntPtr str = LuaAPI.lua_tolstring(L, 2, out strlen);

                    if (str != System.IntPtr.Zero && strlen.ToInt32() == 1)
                    {
                        byte op = System.Runtime.InteropServices.Marshal.ReadByte(str);


                        if (op == (byte)'+')
                        {
                            __cl_gen_to_be_invoked.TestEvent += __gen_delegate;
                            return(0);
                        }


                        if (op == (byte)'-')
                        {
                            __cl_gen_to_be_invoked.TestEvent -= __gen_delegate;
                            return(0);
                        }
                    }
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            LuaAPI.luaL_error(L, "invalid arguments to Tutorial.DrivenClass.TestEvent!");
            return(0);
        }
Exemplo n.º 2
0
        static int _e_completed(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            int __gen_param_count       = LuaAPI.lua_gettop(L);

            UnityEngine.AsyncOperation __cl_gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
            try {
                System.Action <UnityEngine.AsyncOperation> __gen_delegate = translator.GetDelegate <System.Action <UnityEngine.AsyncOperation> >(L, 3);
                if (__gen_delegate == null)
                {
                    return(LuaAPI.luaL_error(L, "#3 need System.Action<UnityEngine.AsyncOperation>!"));
                }

                if (__gen_param_count == 3)
                {
                    System.IntPtr strlen;

                    System.IntPtr str = LuaAPI.lua_tolstring(L, 2, out strlen);

                    if (str != System.IntPtr.Zero && strlen.ToInt32() == 1)
                    {
                        byte op = System.Runtime.InteropServices.Marshal.ReadByte(str);


                        if (op == (byte)'+')
                        {
                            __cl_gen_to_be_invoked.completed += __gen_delegate;
                            return(0);
                        }


                        if (op == (byte)'-')
                        {
                            __cl_gen_to_be_invoked.completed -= __gen_delegate;
                            return(0);
                        }
                    }
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AsyncOperation.completed!");
            return(0);
        }
Exemplo n.º 3
0
        static int _e_onPressCallBack(RealStatePtr L)
        {
            ObjectTranslator translator          = ObjectTranslatorPool.Instance.Find(L);
            int           __gen_param_count      = LuaAPI.lua_gettop(L);
            ComTouchPress __cl_gen_to_be_invoked = (ComTouchPress)translator.FastGetCSObj(L, 1);

            try {
                ComTouchPress.OnPress __gen_delegate = translator.GetDelegate <ComTouchPress.OnPress>(L, 3);
                if (__gen_delegate == null)
                {
                    return(LuaAPI.luaL_error(L, "#3 need ComTouchPress.OnPress!"));
                }

                if (__gen_param_count == 3)
                {
                    System.IntPtr strlen;

                    System.IntPtr str = LuaAPI.lua_tolstring(L, 2, out strlen);

                    if (str != System.IntPtr.Zero && strlen.ToInt32() == 1)
                    {
                        byte op = System.Runtime.InteropServices.Marshal.ReadByte(str);


                        if (op == (byte)'+')
                        {
                            __cl_gen_to_be_invoked.onPressCallBack += __gen_delegate;
                            return(0);
                        }


                        if (op == (byte)'-')
                        {
                            __cl_gen_to_be_invoked.onPressCallBack -= __gen_delegate;
                            return(0);
                        }
                    }
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            LuaAPI.luaL_error(L, "invalid arguments to ComTouchPress.onPressCallBack!");
            return(0);
        }
Exemplo n.º 4
0
        static int _e_onPointerExit(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            int __gen_param_count       = LuaAPI.lua_gettop(L);

            xc.ui.ugui.EventTriggerListener __cl_gen_to_be_invoked = (xc.ui.ugui.EventTriggerListener)translator.FastGetCSObj(L, 1);
            try {
                xc.ui.ugui.EventTriggerListener.UIDelegate __gen_delegate = translator.GetDelegate <xc.ui.ugui.EventTriggerListener.UIDelegate>(L, 3);
                if (__gen_delegate == null)
                {
                    return(LuaAPI.luaL_error(L, "#3 need xc.ui.ugui.EventTriggerListener.UIDelegate!"));
                }

                if (__gen_param_count == 3)
                {
                    System.IntPtr strlen;

                    System.IntPtr str = LuaAPI.lua_tolstring(L, 2, out strlen);

                    if (str != System.IntPtr.Zero && strlen.ToInt32() == 1)
                    {
                        byte op = System.Runtime.InteropServices.Marshal.ReadByte(str);


                        if (op == (byte)'+')
                        {
                            __cl_gen_to_be_invoked.onPointerExit += __gen_delegate;
                            return(0);
                        }


                        if (op == (byte)'-')
                        {
                            __cl_gen_to_be_invoked.onPointerExit -= __gen_delegate;
                            return(0);
                        }
                    }
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            LuaAPI.luaL_error(L, "invalid arguments to xc.ui.ugui.EventTriggerListener.onPointerExit!");
            return(0);
        }
Exemplo n.º 5
0
        private static unsafe zstring lua_tozstring(RealStatePtr L, int index)
        {
            RealStatePtr strlen;
            IntPtr       str = LuaAPI.lua_tolstring(L, index, out strlen);

            if (str != IntPtr.Zero)
            {
                int byteLen   = strlen.ToInt32();
                int strLength = Encoding.UTF8.GetCharCount((byte *)str, byteLen);
                //从zstring对象池中获取string
                zstring zstr = zstring.get(strLength);
                string  ret  = zstr;
                fixed(char *chars = ret)
                {
                    Encoding.UTF8.GetChars((byte *)str, byteLen, chars, strLength);
                }

                return(zstr);
            }
            return(null);
        }