104 lines
2.6 KiB
C#
104 lines
2.6 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_InputValidatorWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(TMPro.TMP_InputValidator);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 1, 0, 0);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Validate", _m_Validate);
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
{
|
|
return LuaAPI.luaL_error(L, "TMPro.TMP_InputValidator does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Validate(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
TMPro.TMP_InputValidator gen_to_be_invoked = (TMPro.TMP_InputValidator)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _text = LuaAPI.lua_tostring(L, 2);
|
|
int _pos = LuaAPI.xlua_tointeger(L, 3);
|
|
char _ch = (char)LuaAPI.xlua_tointeger(L, 4);
|
|
|
|
var gen_ret = gen_to_be_invoked.Validate( ref _text, ref _pos, _ch );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
LuaAPI.lua_pushstring(L, _text);
|
|
|
|
LuaAPI.xlua_pushinteger(L, _pos);
|
|
|
|
|
|
|
|
|
|
return 3;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|