#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 UnityEngineScreenWrap { public static void __Register(RealStatePtr L) { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(UnityEngine.Screen); Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 5, 19, 9); Utils.RegisterFunc(L, Utils.CLS_IDX, "SetResolution", _m_SetResolution_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "SetMSAASamples", _m_SetMSAASamples_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDisplayLayout", _m_GetDisplayLayout_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "MoveMainWindowTo", _m_MoveMainWindowTo_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "width", _g_get_width); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "height", _g_get_height); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "dpi", _g_get_dpi); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "currentResolution", _g_get_currentResolution); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "resolutions", _g_get_resolutions); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "msaaSamples", _g_get_msaaSamples); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fullScreen", _g_get_fullScreen); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "fullScreenMode", _g_get_fullScreenMode); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "safeArea", _g_get_safeArea); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "cutouts", _g_get_cutouts); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "autorotateToPortrait", _g_get_autorotateToPortrait); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "autorotateToPortraitUpsideDown", _g_get_autorotateToPortraitUpsideDown); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "autorotateToLandscapeLeft", _g_get_autorotateToLandscapeLeft); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "autorotateToLandscapeRight", _g_get_autorotateToLandscapeRight); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "orientation", _g_get_orientation); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "sleepTimeout", _g_get_sleepTimeout); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "brightness", _g_get_brightness); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "mainWindowPosition", _g_get_mainWindowPosition); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "mainWindowDisplayInfo", _g_get_mainWindowDisplayInfo); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "fullScreen", _s_set_fullScreen); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "fullScreenMode", _s_set_fullScreenMode); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "autorotateToPortrait", _s_set_autorotateToPortrait); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "autorotateToPortraitUpsideDown", _s_set_autorotateToPortraitUpsideDown); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "autorotateToLandscapeLeft", _s_set_autorotateToLandscapeLeft); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "autorotateToLandscapeRight", _s_set_autorotateToLandscapeRight); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "orientation", _s_set_orientation); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "sleepTimeout", _s_set_sleepTimeout); Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "brightness", _s_set_brightness); 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.Screen gen_ret = new UnityEngine.Screen(); 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.Screen constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_SetResolution_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 3&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)) { int _width = LuaAPI.xlua_tointeger(L, 1); int _height = LuaAPI.xlua_tointeger(L, 2); bool _fullscreen = LuaAPI.lua_toboolean(L, 3); UnityEngine.Screen.SetResolution( _width, _height, _fullscreen ); return 0; } if(gen_param_count == 3&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& (translator.Assignable(L, 3)||LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))) { int _width = LuaAPI.xlua_tointeger(L, 1); int _height = LuaAPI.xlua_tointeger(L, 2); UnityEngine.FullScreenMode _fullscreenMode;if (LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TNUMBER)_fullscreenMode = (UnityEngine.FullScreenMode)LuaAPI.lua_tonumber(L, 3);else translator.Get(L, 3, out _fullscreenMode); UnityEngine.Screen.SetResolution( _width, _height, _fullscreenMode ); return 0; } if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& (translator.Assignable(L, 3)||LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))&& translator.Assignable(L, 4)) { int _width = LuaAPI.xlua_tointeger(L, 1); int _height = LuaAPI.xlua_tointeger(L, 2); UnityEngine.FullScreenMode _fullscreenMode;if (LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TNUMBER)_fullscreenMode = (UnityEngine.FullScreenMode)LuaAPI.lua_tonumber(L, 3);else translator.Get(L, 3, out _fullscreenMode); UnityEngine.RefreshRate _preferredRefreshRate;translator.Get(L, 4, out _preferredRefreshRate); UnityEngine.Screen.SetResolution( _width, _height, _fullscreenMode, _preferredRefreshRate ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Screen.SetResolution!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_SetMSAASamples_xlua_st_(RealStatePtr L) { try { { int _numSamples = LuaAPI.xlua_tointeger(L, 1); UnityEngine.Screen.SetMSAASamples( _numSamples ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetDisplayLayout_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); { System.Collections.Generic.List _displayLayout = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); UnityEngine.Screen.GetDisplayLayout( _displayLayout ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_MoveMainWindowTo_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); { UnityEngine.DisplayInfo _display;translator.Get(L, 1, out _display); UnityEngine.Vector2Int _position;translator.Get(L, 2, out _position); UnityEngine.AsyncOperation gen_ret = UnityEngine.Screen.MoveMainWindowTo( _display, _position ); translator.Push(L, gen_ret); translator.Push(L, _display); translator.Update(L, 1, _display); return 2; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_width(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Screen.width); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_height(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Screen.height); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_dpi(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Screen.dpi); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_currentResolution(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.currentResolution); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_resolutions(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.resolutions); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_msaaSamples(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Screen.msaaSamples); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fullScreen(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Screen.fullScreen); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_fullScreenMode(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.fullScreenMode); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_safeArea(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.safeArea); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_cutouts(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.cutouts); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_autorotateToPortrait(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Screen.autorotateToPortrait); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_autorotateToPortraitUpsideDown(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Screen.autorotateToPortraitUpsideDown); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_autorotateToLandscapeLeft(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Screen.autorotateToLandscapeLeft); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_autorotateToLandscapeRight(RealStatePtr L) { try { LuaAPI.lua_pushboolean(L, UnityEngine.Screen.autorotateToLandscapeRight); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_orientation(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.orientation); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_sleepTimeout(RealStatePtr L) { try { LuaAPI.xlua_pushinteger(L, UnityEngine.Screen.sleepTimeout); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_brightness(RealStatePtr L) { try { LuaAPI.lua_pushnumber(L, UnityEngine.Screen.brightness); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_mainWindowPosition(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.mainWindowPosition); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_mainWindowDisplayInfo(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.Screen.mainWindowDisplayInfo); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_fullScreen(RealStatePtr L) { try { UnityEngine.Screen.fullScreen = LuaAPI.lua_toboolean(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_fullScreenMode(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); UnityEngine.FullScreenMode gen_value;if (LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TNUMBER)gen_value = (UnityEngine.FullScreenMode)LuaAPI.lua_tonumber(L, 1);else translator.Get(L, 1, out gen_value); UnityEngine.Screen.fullScreenMode = 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_autorotateToPortrait(RealStatePtr L) { try { UnityEngine.Screen.autorotateToPortrait = LuaAPI.lua_toboolean(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_autorotateToPortraitUpsideDown(RealStatePtr L) { try { UnityEngine.Screen.autorotateToPortraitUpsideDown = LuaAPI.lua_toboolean(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_autorotateToLandscapeLeft(RealStatePtr L) { try { UnityEngine.Screen.autorotateToLandscapeLeft = LuaAPI.lua_toboolean(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_autorotateToLandscapeRight(RealStatePtr L) { try { UnityEngine.Screen.autorotateToLandscapeRight = LuaAPI.lua_toboolean(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_orientation(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); UnityEngine.ScreenOrientation gen_value;if (LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TNUMBER)gen_value = (UnityEngine.ScreenOrientation)LuaAPI.lua_tonumber(L, 1);else translator.Get(L, 1, out gen_value); UnityEngine.Screen.orientation = 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_sleepTimeout(RealStatePtr L) { try { UnityEngine.Screen.sleepTimeout = LuaAPI.xlua_tointeger(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_brightness(RealStatePtr L) { try { UnityEngine.Screen.brightness = (float)LuaAPI.lua_tonumber(L, 1); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }