#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 TMProKerningPairWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(TMPro.KerningPair); Utils.BeginObjectRegister(type, L, translator, 0, 0, 6, 3); Utils.RegisterFunc(L, Utils.GETTER_IDX, "firstGlyph", _g_get_firstGlyph); Utils.RegisterFunc(L, Utils.GETTER_IDX, "firstGlyphAdjustments", _g_get_firstGlyphAdjustments); Utils.RegisterFunc(L, Utils.GETTER_IDX, "secondGlyph", _g_get_secondGlyph); Utils.RegisterFunc(L, Utils.GETTER_IDX, "secondGlyphAdjustments", _g_get_secondGlyphAdjustments); Utils.RegisterFunc(L, Utils.GETTER_IDX, "ignoreSpacingAdjustments", _g_get_ignoreSpacingAdjustments); Utils.RegisterFunc(L, Utils.GETTER_IDX, "xOffset", _g_get_xOffset); Utils.RegisterFunc(L, Utils.SETTER_IDX, "firstGlyph", _s_set_firstGlyph); Utils.RegisterFunc(L, Utils.SETTER_IDX, "secondGlyph", _s_set_secondGlyph); Utils.RegisterFunc(L, Utils.SETTER_IDX, "xOffset", _s_set_xOffset); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0); 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) == 1) { var gen_ret = new TMPro.KerningPair(); 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)) { uint _left = LuaAPI.xlua_touint(L, 2); uint _right = LuaAPI.xlua_touint(L, 3); float _offset = (float)LuaAPI.lua_tonumber(L, 4); var gen_ret = new TMPro.KerningPair(_left, _right, _offset); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && translator.Assignable(L, 5)) { uint _firstGlyph = LuaAPI.xlua_touint(L, 2); TMPro.GlyphValueRecord_Legacy _firstGlyphAdjustments;translator.Get(L, 3, out _firstGlyphAdjustments); uint _secondGlyph = LuaAPI.xlua_touint(L, 4); TMPro.GlyphValueRecord_Legacy _secondGlyphAdjustments;translator.Get(L, 5, out _secondGlyphAdjustments); var gen_ret = new TMPro.KerningPair(_firstGlyph, _firstGlyphAdjustments, _secondGlyph, _secondGlyphAdjustments); 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 TMPro.KerningPair constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_firstGlyph(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushuint(L, gen_to_be_invoked.firstGlyph); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_firstGlyphAdjustments(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.firstGlyphAdjustments); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_secondGlyph(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushuint(L, gen_to_be_invoked.secondGlyph); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_secondGlyphAdjustments(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.secondGlyphAdjustments); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_ignoreSpacingAdjustments(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.ignoreSpacingAdjustments); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_xOffset(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.xOffset); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_firstGlyph(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); gen_to_be_invoked.firstGlyph = LuaAPI.xlua_touint(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_secondGlyph(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); gen_to_be_invoked.secondGlyph = LuaAPI.xlua_touint(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_xOffset(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); TMPro.KerningPair gen_to_be_invoked = (TMPro.KerningPair)translator.FastGetCSObj(L, 1); gen_to_be_invoked.xOffset = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }