#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 UnityEngineWebCamTextureWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(UnityEngine.WebCamTexture); Utils.BeginObjectRegister(type, L, translator, 0, 6, 10, 5); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Play", _m_Play); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Pause", _m_Pause); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Stop", _m_Stop); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetPixel", _m_GetPixel); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetPixels", _m_GetPixels); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetPixels32", _m_GetPixels32); Utils.RegisterFunc(L, Utils.GETTER_IDX, "isPlaying", _g_get_isPlaying); Utils.RegisterFunc(L, Utils.GETTER_IDX, "deviceName", _g_get_deviceName); Utils.RegisterFunc(L, Utils.GETTER_IDX, "requestedFPS", _g_get_requestedFPS); Utils.RegisterFunc(L, Utils.GETTER_IDX, "requestedWidth", _g_get_requestedWidth); Utils.RegisterFunc(L, Utils.GETTER_IDX, "requestedHeight", _g_get_requestedHeight); Utils.RegisterFunc(L, Utils.GETTER_IDX, "videoRotationAngle", _g_get_videoRotationAngle); Utils.RegisterFunc(L, Utils.GETTER_IDX, "videoVerticallyMirrored", _g_get_videoVerticallyMirrored); Utils.RegisterFunc(L, Utils.GETTER_IDX, "didUpdateThisFrame", _g_get_didUpdateThisFrame); Utils.RegisterFunc(L, Utils.GETTER_IDX, "autoFocusPoint", _g_get_autoFocusPoint); Utils.RegisterFunc(L, Utils.GETTER_IDX, "isDepth", _g_get_isDepth); Utils.RegisterFunc(L, Utils.SETTER_IDX, "deviceName", _s_set_deviceName); Utils.RegisterFunc(L, Utils.SETTER_IDX, "requestedFPS", _s_set_requestedFPS); Utils.RegisterFunc(L, Utils.SETTER_IDX, "requestedWidth", _s_set_requestedWidth); Utils.RegisterFunc(L, Utils.SETTER_IDX, "requestedHeight", _s_set_requestedHeight); Utils.RegisterFunc(L, Utils.SETTER_IDX, "autoFocusPoint", _s_set_autoFocusPoint); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 1, 1, 0); Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "devices", _g_get_devices); 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) == 5 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5)) { string _deviceName = LuaAPI.lua_tostring(L, 2); int _requestedWidth = LuaAPI.xlua_tointeger(L, 3); int _requestedHeight = LuaAPI.xlua_tointeger(L, 4); int _requestedFPS = LuaAPI.xlua_tointeger(L, 5); var gen_ret = new UnityEngine.WebCamTexture(_deviceName, _requestedWidth, _requestedHeight, _requestedFPS); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { string _deviceName = LuaAPI.lua_tostring(L, 2); int _requestedWidth = LuaAPI.xlua_tointeger(L, 3); int _requestedHeight = LuaAPI.xlua_tointeger(L, 4); var gen_ret = new UnityEngine.WebCamTexture(_deviceName, _requestedWidth, _requestedHeight); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _deviceName = LuaAPI.lua_tostring(L, 2); var gen_ret = new UnityEngine.WebCamTexture(_deviceName); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { int _requestedWidth = LuaAPI.xlua_tointeger(L, 2); int _requestedHeight = LuaAPI.xlua_tointeger(L, 3); int _requestedFPS = LuaAPI.xlua_tointeger(L, 4); var gen_ret = new UnityEngine.WebCamTexture(_requestedWidth, _requestedHeight, _requestedFPS); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int _requestedWidth = LuaAPI.xlua_tointeger(L, 2); int _requestedHeight = LuaAPI.xlua_tointeger(L, 3); var gen_ret = new UnityEngine.WebCamTexture(_requestedWidth, _requestedHeight); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 1) { var gen_ret = new UnityEngine.WebCamTexture(); 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.WebCamTexture constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Play(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Play( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Pause(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Pause( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Stop(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Stop( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetPixel(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); { int _x = LuaAPI.xlua_tointeger(L, 2); int _y = LuaAPI.xlua_tointeger(L, 3); var gen_ret = gen_to_be_invoked.GetPixel( _x, _y ); translator.PushUnityEngineColor(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_GetPixels(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { var gen_ret = gen_to_be_invoked.GetPixels( ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 5&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5)) { int _x = LuaAPI.xlua_tointeger(L, 2); int _y = LuaAPI.xlua_tointeger(L, 3); int _blockWidth = LuaAPI.xlua_tointeger(L, 4); int _blockHeight = LuaAPI.xlua_tointeger(L, 5); var gen_ret = gen_to_be_invoked.GetPixels( _x, _y, _blockWidth, _blockHeight ); 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.WebCamTexture.GetPixels!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetPixels32(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { var gen_ret = gen_to_be_invoked.GetPixels32( ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& translator.Assignable(L, 2)) { UnityEngine.Color32[] _colors = (UnityEngine.Color32[])translator.GetObject(L, 2, typeof(UnityEngine.Color32[])); var gen_ret = gen_to_be_invoked.GetPixels32( _colors ); 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.WebCamTexture.GetPixels32!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_devices(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); translator.Push(L, UnityEngine.WebCamTexture.devices); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_isPlaying(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isPlaying); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_deviceName(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushstring(L, gen_to_be_invoked.deviceName); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_requestedFPS(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.requestedFPS); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_requestedWidth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.requestedWidth); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_requestedHeight(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.requestedHeight); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_videoRotationAngle(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.videoRotationAngle); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_videoVerticallyMirrored(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.videoVerticallyMirrored); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_didUpdateThisFrame(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.didUpdateThisFrame); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_autoFocusPoint(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.autoFocusPoint); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_isDepth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isDepth); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_deviceName(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); gen_to_be_invoked.deviceName = LuaAPI.lua_tostring(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_requestedFPS(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); gen_to_be_invoked.requestedFPS = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_requestedWidth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); gen_to_be_invoked.requestedWidth = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_requestedHeight(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); gen_to_be_invoked.requestedHeight = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_autoFocusPoint(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.WebCamTexture gen_to_be_invoked = (UnityEngine.WebCamTexture)translator.FastGetCSObj(L, 1); System.Nullable gen_value;translator.Get(L, 2, out gen_value); gen_to_be_invoked.autoFocusPoint = gen_value; } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }