143 lines
4.8 KiB
C#
143 lines
4.8 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_SpriteGlyphWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(TMPro.TMP_SpriteGlyph);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "sprite", _g_get_sprite);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "sprite", _s_set_sprite);
|
|
|
|
|
|
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_SpriteGlyph();
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 6 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<UnityEngine.TextCore.GlyphMetrics>(L, 3) && translator.Assignable<UnityEngine.TextCore.GlyphRect>(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6))
|
|
{
|
|
uint _index = LuaAPI.xlua_touint(L, 2);
|
|
UnityEngine.TextCore.GlyphMetrics _metrics;translator.Get(L, 3, out _metrics);
|
|
UnityEngine.TextCore.GlyphRect _glyphRect;translator.Get(L, 4, out _glyphRect);
|
|
float _scale = (float)LuaAPI.lua_tonumber(L, 5);
|
|
int _atlasIndex = LuaAPI.xlua_tointeger(L, 6);
|
|
|
|
var gen_ret = new TMPro.TMP_SpriteGlyph(_index, _metrics, _glyphRect, _scale, _atlasIndex);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 7 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<UnityEngine.TextCore.GlyphMetrics>(L, 3) && translator.Assignable<UnityEngine.TextCore.GlyphRect>(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && translator.Assignable<UnityEngine.Sprite>(L, 7))
|
|
{
|
|
uint _index = LuaAPI.xlua_touint(L, 2);
|
|
UnityEngine.TextCore.GlyphMetrics _metrics;translator.Get(L, 3, out _metrics);
|
|
UnityEngine.TextCore.GlyphRect _glyphRect;translator.Get(L, 4, out _glyphRect);
|
|
float _scale = (float)LuaAPI.lua_tonumber(L, 5);
|
|
int _atlasIndex = LuaAPI.xlua_tointeger(L, 6);
|
|
UnityEngine.Sprite _sprite = (UnityEngine.Sprite)translator.GetObject(L, 7, typeof(UnityEngine.Sprite));
|
|
|
|
var gen_ret = new TMPro.TMP_SpriteGlyph(_index, _metrics, _glyphRect, _scale, _atlasIndex, _sprite);
|
|
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_SpriteGlyph constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_sprite(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.TMP_SpriteGlyph gen_to_be_invoked = (TMPro.TMP_SpriteGlyph)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.sprite);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_sprite(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
TMPro.TMP_SpriteGlyph gen_to_be_invoked = (TMPro.TMP_SpriteGlyph)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.sprite = (UnityEngine.Sprite)translator.GetObject(L, 2, typeof(UnityEngine.Sprite));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|