#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 UnityEngineTimeWrap { public static void __Register(RealStatePtr L) { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(UnityEngine.Time); Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 1, 27, 7); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "time", _g_get_time); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "timeAsDouble", _g_get_timeAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "timeAsRational", _g_get_timeAsRational); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "timeSinceLevelLoad", _g_get_timeSinceLevelLoad); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "timeSinceLevelLoadAsDouble", _g_get_timeSinceLevelLoadAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "deltaTime", _g_get_deltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedTime", _g_get_fixedTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedTimeAsDouble", _g_get_fixedTimeAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "unscaledTime", _g_get_unscaledTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "unscaledTimeAsDouble", _g_get_unscaledTimeAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedUnscaledTime", _g_get_fixedUnscaledTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedUnscaledTimeAsDouble", _g_get_fixedUnscaledTimeAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "unscaledDeltaTime", _g_get_unscaledDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedUnscaledDeltaTime", _g_get_fixedUnscaledDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fixedDeltaTime", _g_get_fixedDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "maximumDeltaTime", _g_get_maximumDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "smoothDeltaTime", _g_get_smoothDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "maximumParticleDeltaTime", _g_get_maximumParticleDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "timeScale", _g_get_timeScale); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "frameCount", _g_get_frameCount); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "renderedFrameCount", _g_get_renderedFrameCount); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "realtimeSinceStartup", _g_get_realtimeSinceStartup); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "realtimeSinceStartupAsDouble", _g_get_realtimeSinceStartupAsDouble); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "captureDeltaTime", _g_get_captureDeltaTime); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "captureDeltaTimeRational", _g_get_captureDeltaTimeRational); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "captureFramerate", _g_get_captureFramerate); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "inFixedTimeStep", _g_get_inFixedTimeStep); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "fixedDeltaTime", _s_set_fixedDeltaTime); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "maximumDeltaTime", _s_set_maximumDeltaTime); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "maximumParticleDeltaTime", _s_set_maximumParticleDeltaTime); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "timeScale", _s_set_timeScale); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "captureDeltaTime", _s_set_captureDeltaTime); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "captureDeltaTimeRational", _s_set_captureDeltaTimeRational); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "captureFramerate", _s_set_captureFramerate); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 1) { UnityEngine.Time gen_ret = new UnityEngine.Time(); 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 UnityEngine.Time constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_time(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.time); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_timeAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.timeAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_timeAsRational(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Time.timeAsRational); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_timeSinceLevelLoad(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.timeSinceLevelLoad); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_timeSinceLevelLoadAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.timeSinceLevelLoadAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_deltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.deltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedTimeAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedTimeAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_unscaledTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.unscaledTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_unscaledTimeAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.unscaledTimeAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedUnscaledTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedUnscaledTimeAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledTimeAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_unscaledDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.unscaledDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedUnscaledDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fixedDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.fixedDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_maximumDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.maximumDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_smoothDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.smoothDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_maximumParticleDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.maximumParticleDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_timeScale(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.timeScale); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_frameCount(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Time.frameCount); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_renderedFrameCount(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Time.renderedFrameCount); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_realtimeSinceStartup(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.realtimeSinceStartup); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_realtimeSinceStartupAsDouble(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.realtimeSinceStartupAsDouble); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_captureDeltaTime(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Time.captureDeltaTime); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_captureDeltaTimeRational(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Time.captureDeltaTimeRational); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_captureFramerate(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Time.captureFramerate); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_inFixedTimeStep(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Time.inFixedTimeStep); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_fixedDeltaTime(RealStatePtr L) { try { UnityEngine.Time.fixedDeltaTime = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_maximumDeltaTime(RealStatePtr L) { try { UnityEngine.Time.maximumDeltaTime = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_maximumParticleDeltaTime(RealStatePtr L) { try { UnityEngine.Time.maximumParticleDeltaTime = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_timeScale(RealStatePtr L) { try { UnityEngine.Time.timeScale = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_captureDeltaTime(RealStatePtr L) { try { UnityEngine.Time.captureDeltaTime = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_captureDeltaTimeRational(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); Unity.IntegerTime.RationalTime gen_value;translator.Get(L, 1, out gen_value); UnityEngine.Time.captureDeltaTimeRational = gen_value; } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_captureFramerate(RealStatePtr L) { try { UnityEngine.Time.captureFramerate = LuaAPI.xlua_tointeger(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }