192 lines
6.1 KiB
C#
192 lines
6.1 KiB
C#
#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 TMProKerningPairKeyWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(TMPro.KerningPairKey);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 3, 3);
|
|
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ascii_Left", _g_get_ascii_Left);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "ascii_Right", _g_get_ascii_Right);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "key", _g_get_key);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "ascii_Left", _s_set_ascii_Left);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "ascii_Right", _s_set_ascii_Right);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "key", _s_set_key);
|
|
|
|
|
|
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) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
|
|
{
|
|
uint _ascii_left = LuaAPI.xlua_touint(L, 2);
|
|
uint _ascii_right = LuaAPI.xlua_touint(L, 3);
|
|
|
|
var gen_ret = new TMPro.KerningPairKey(_ascii_left, _ascii_right);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
|
|
if (LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
translator.Push(L, default(TMPro.KerningPairKey));
|
|
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.KerningPairKey constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ascii_Left(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushuint(L, gen_to_be_invoked.ascii_Left);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_ascii_Right(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushuint(L, gen_to_be_invoked.ascii_Right);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_key(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushuint(L, gen_to_be_invoked.key);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_ascii_Left(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
gen_to_be_invoked.ascii_Left = LuaAPI.xlua_touint(L, 2);
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_ascii_Right(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
gen_to_be_invoked.ascii_Right = LuaAPI.xlua_touint(L, 2);
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_key(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.KerningPairKey gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
gen_to_be_invoked.key = LuaAPI.xlua_touint(L, 2);
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|