152 lines
4.7 KiB
C#
152 lines
4.7 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 TMProTMP_SpriteCharacterWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(TMPro.TMP_SpriteCharacter);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 2, 1);
|
|
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "name", _g_get_name);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "hashCode", _g_get_hashCode);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "name", _s_set_name);
|
|
|
|
|
|
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.TMP_SpriteCharacter();
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<TMPro.TMP_SpriteGlyph>(L, 3))
|
|
{
|
|
uint _unicode = LuaAPI.xlua_touint(L, 2);
|
|
TMPro.TMP_SpriteGlyph _glyph = (TMPro.TMP_SpriteGlyph)translator.GetObject(L, 3, typeof(TMPro.TMP_SpriteGlyph));
|
|
|
|
var gen_ret = new TMPro.TMP_SpriteCharacter(_unicode, _glyph);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<TMPro.TMP_SpriteAsset>(L, 3) && translator.Assignable<TMPro.TMP_SpriteGlyph>(L, 4))
|
|
{
|
|
uint _unicode = LuaAPI.xlua_touint(L, 2);
|
|
TMPro.TMP_SpriteAsset _spriteAsset = (TMPro.TMP_SpriteAsset)translator.GetObject(L, 3, typeof(TMPro.TMP_SpriteAsset));
|
|
TMPro.TMP_SpriteGlyph _glyph = (TMPro.TMP_SpriteGlyph)translator.GetObject(L, 4, typeof(TMPro.TMP_SpriteGlyph));
|
|
|
|
var gen_ret = new TMPro.TMP_SpriteCharacter(_unicode, _spriteAsset, _glyph);
|
|
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.TMP_SpriteCharacter constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_name(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.TMP_SpriteCharacter gen_to_be_invoked = (TMPro.TMP_SpriteCharacter)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.name);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_hashCode(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.TMP_SpriteCharacter gen_to_be_invoked = (TMPro.TMP_SpriteCharacter)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.hashCode);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_name(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.TMP_SpriteCharacter gen_to_be_invoked = (TMPro.TMP_SpriteCharacter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.name = LuaAPI.lua_tostring(L, 2);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|