184 lines
5.8 KiB
C#
184 lines
5.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_MathWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(TMPro.TMP_Math);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 9, 2, 2);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Approximately", _m_Approximately_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Mod", _m_Mod_xlua_st_);
|
|
|
|
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "FLOAT_MAX", TMPro.TMP_Math.FLOAT_MAX);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "FLOAT_MIN", TMPro.TMP_Math.FLOAT_MIN);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "INT_MAX", TMPro.TMP_Math.INT_MAX);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "INT_MIN", TMPro.TMP_Math.INT_MIN);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "FLOAT_UNSET", TMPro.TMP_Math.FLOAT_UNSET);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "INT_UNSET", TMPro.TMP_Math.INT_UNSET);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "MAX_16BIT", _g_get_MAX_16BIT);
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "MIN_16BIT", _g_get_MIN_16BIT);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "MAX_16BIT", _s_set_MAX_16BIT);
|
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "MIN_16BIT", _s_set_MIN_16BIT);
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
return LuaAPI.luaL_error(L, "TMPro.TMP_Math does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Approximately_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
float _a = (float)LuaAPI.lua_tonumber(L, 1);
|
|
float _b = (float)LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = TMPro.TMP_Math.Approximately( _a, _b );
|
|
LuaAPI.lua_pushboolean(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_Mod_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
|
|
|
|
|
|
{
|
|
int _a = LuaAPI.xlua_tointeger(L, 1);
|
|
int _b = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = TMPro.TMP_Math.Mod( _a, _b );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_MAX_16BIT(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
translator.PushUnityEngineVector2(L, TMPro.TMP_Math.MAX_16BIT);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_MIN_16BIT(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
translator.PushUnityEngineVector2(L, TMPro.TMP_Math.MIN_16BIT);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_MAX_16BIT(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
UnityEngine.Vector2 gen_value;translator.Get(L, 1, out gen_value);
|
|
TMPro.TMP_Math.MAX_16BIT = gen_value;
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_MIN_16BIT(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
UnityEngine.Vector2 gen_value;translator.Get(L, 1, out gen_value);
|
|
TMPro.TMP_Math.MIN_16BIT = gen_value;
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|