448 lines
14 KiB
C#
448 lines
14 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 BFDrawBezierLineWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.DrawBezierLine);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 10, 1, 1);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetStartPoint", _m_SetStartPoint);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetEndPoint", _m_SetEndPoint);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetControlPoint1", _m_SetControlPoint1);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetControlPoint2", _m_SetControlPoint2);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetDrawPointCount", _m_SetDrawPointCount);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "DrawLine", _m_DrawLine);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ClearLine", _m_ClearLine);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetPathList", _m_GetPathList);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetUseCubicBezier", _m_SetUseCubicBezier);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetPointInCubicBezierCurve", _m_GetPointInCubicBezierCurve);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "lineRender", _g_get_lineRender);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "lineRender", _s_set_lineRender);
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetBezierPoint", _m_GetBezierPoint_xlua_st_);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 BF.DrawBezierLine();
|
|
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 BF.DrawBezierLine constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetStartPoint(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
float _x = (float)LuaAPI.lua_tonumber(L, 2);
|
|
float _y = (float)LuaAPI.lua_tonumber(L, 3);
|
|
float _z = (float)LuaAPI.lua_tonumber(L, 4);
|
|
|
|
gen_to_be_invoked.SetStartPoint( _x, _y, _z );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetEndPoint(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
float _x = (float)LuaAPI.lua_tonumber(L, 2);
|
|
float _y = (float)LuaAPI.lua_tonumber(L, 3);
|
|
float _z = (float)LuaAPI.lua_tonumber(L, 4);
|
|
|
|
gen_to_be_invoked.SetEndPoint( _x, _y, _z );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetControlPoint1(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
float _x = (float)LuaAPI.lua_tonumber(L, 2);
|
|
float _y = (float)LuaAPI.lua_tonumber(L, 3);
|
|
float _z = (float)LuaAPI.lua_tonumber(L, 4);
|
|
|
|
gen_to_be_invoked.SetControlPoint1( _x, _y, _z );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetControlPoint2(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
float _x = (float)LuaAPI.lua_tonumber(L, 2);
|
|
float _y = (float)LuaAPI.lua_tonumber(L, 3);
|
|
float _z = (float)LuaAPI.lua_tonumber(L, 4);
|
|
|
|
gen_to_be_invoked.SetControlPoint2( _x, _y, _z );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetDrawPointCount(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _count = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
gen_to_be_invoked.SetDrawPointCount( _count );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_DrawLine(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.DrawLine( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ClearLine(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.ClearLine( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetPathList(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetPathList( );
|
|
translator.Push(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_SetUseCubicBezier(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
bool _use = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
gen_to_be_invoked.SetUseCubicBezier( _use );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetBezierPoint_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
float _t = (float)LuaAPI.lua_tonumber(L, 1);
|
|
UnityEngine.Vector3 _start;translator.Get(L, 2, out _start);
|
|
UnityEngine.Vector3 _controlPoint;translator.Get(L, 3, out _controlPoint);
|
|
UnityEngine.Vector3 _end;translator.Get(L, 4, out _end);
|
|
|
|
var gen_ret = BF.DrawBezierLine.GetBezierPoint( _t, _start, _controlPoint, _end );
|
|
translator.PushUnityEngineVector3(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_GetPointInCubicBezierCurve(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
float _t = (float)LuaAPI.lua_tonumber(L, 2);
|
|
UnityEngine.Vector3 _startPoint;translator.Get(L, 3, out _startPoint);
|
|
UnityEngine.Vector3 _controlPoint1;translator.Get(L, 4, out _controlPoint1);
|
|
UnityEngine.Vector3 _controlPoint2;translator.Get(L, 5, out _controlPoint2);
|
|
UnityEngine.Vector3 _endPoint;translator.Get(L, 6, out _endPoint);
|
|
|
|
var gen_ret = gen_to_be_invoked.GetPointInCubicBezierCurve( _t, _startPoint, _controlPoint1, _controlPoint2, _endPoint );
|
|
translator.PushUnityEngineVector3(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_lineRender(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.lineRender);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_lineRender(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.DrawBezierLine gen_to_be_invoked = (BF.DrawBezierLine)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.lineRender = (UnityEngine.LineRenderer)translator.GetObject(L, 2, typeof(UnityEngine.LineRenderer));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|