#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class ClockWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(Clock); Utils.BeginObjectRegister(type, L, translator, 0, 2, 1, 1); Utils.RegisterFunc(L, Utils.METHOD_IDX, "CanAlarm", _m_CanAlarm); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Execute", _m_Execute); Utils.RegisterFunc(L, Utils.GETTER_IDX, "stopped", _g_get_stopped); Utils.RegisterFunc(L, Utils.SETTER_IDX, "stopped", _s_set_stopped); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 5, 0, 0); Utils.RegisterFunc(L, Utils.CLS_IDX, "Init", _m_Init_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "AlarmAt", _m_AlarmAt_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "AlarmAfter", _m_AlarmAfter_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "Stop", _m_Stop_xlua_st_); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable(L, 2) && translator.Assignable(L, 3)) { System.DateTime _alarmTime;translator.Get(L, 2, out _alarmTime); UnityEngine.Events.UnityAction _callBack = translator.GetDelegate(L, 3); Clock gen_ret = new Clock(_alarmTime, _callBack); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to Clock constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_CanAlarm(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Clock gen_to_be_invoked = (Clock)translator.FastGetCSObj(L, 1); { bool gen_ret = gen_to_be_invoked.CanAlarm( ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Execute(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Clock gen_to_be_invoked = (Clock)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Execute( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Init_xlua_st_(RealStatePtr L) { try { { Clock.Init( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AlarmAt_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { System.DateTime _alarmTime;translator.Get(L, 1, out _alarmTime); UnityEngine.Events.UnityAction _callBack = translator.GetDelegate(L, 2); Clock gen_ret = Clock.AlarmAt( _alarmTime, _callBack ); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_AlarmAfter_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { double _seconds = LuaAPI.lua_tonumber(L, 1); UnityEngine.Events.UnityAction _callBack = translator.GetDelegate(L, 2); Clock gen_ret = Clock.AlarmAfter( _seconds, _callBack ); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Stop_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { Clock _clock = (Clock)translator.GetObject(L, 1, typeof(Clock)); Clock.Stop( _clock ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_stopped(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Clock gen_to_be_invoked = (Clock)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.stopped); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_stopped(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Clock gen_to_be_invoked = (Clock)translator.FastGetCSObj(L, 1); gen_to_be_invoked.stopped = LuaAPI.lua_toboolean(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }