| | |
| | | { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | System.Type type = typeof(GlobalTimeEvent); |
| | | Utils.BeginObjectRegister(type, L, translator, 0, 8, 0, 0); |
| | | Utils.BeginObjectRegister(type, L, translator, 0, 9, 0, 0); |
| | | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "Begin", _m_Begin); |
| | | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "secondEvent", _e_secondEvent); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "fiveSecondEvent", _e_fiveSecondEvent); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "minuteEvent", _e_minuteEvent); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "fiveMinuteEvent", _e_fiveMinuteEvent); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "tenMinuteEvent", _e_tenMinuteEvent); |
| | |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _e_fiveSecondEvent(RealStatePtr L) |
| | | { |
| | | try { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | int gen_param_count = LuaAPI.lua_gettop(L); |
| | | GlobalTimeEvent gen_to_be_invoked = (GlobalTimeEvent)translator.FastGetCSObj(L, 1); |
| | | 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) |
| | | { |
| | | |
| | | if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { |
| | | gen_to_be_invoked.fiveSecondEvent += gen_delegate; |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { |
| | | gen_to_be_invoked.fiveSecondEvent -= 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 GlobalTimeEvent.fiveSecondEvent!"); |
| | | return 0; |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _e_minuteEvent(RealStatePtr L) |
| | | { |
| | | try { |