Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        static int _m_Init(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            ComTouchPress __cl_gen_to_be_invoked = (ComTouchPress)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 3 && translator.Assignable <ComTouchPress.OnPress>(L, 2) && translator.Assignable <object>(L, 3))
                {
                    ComTouchPress.OnPress callBack = translator.GetDelegate <ComTouchPress.OnPress>(L, 2);
                    object obj = translator.GetObject(L, 3, typeof(object));

                    __cl_gen_to_be_invoked.Init(callBack, obj);



                    return(0);
                }
                if (__gen_param_count == 2 && translator.Assignable <ComTouchPress.OnPress>(L, 2))
                {
                    ComTouchPress.OnPress callBack = translator.GetDelegate <ComTouchPress.OnPress>(L, 2);

                    __cl_gen_to_be_invoked.Init(callBack);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to ComTouchPress.Init!"));
        }