689 lines
23 KiB
C#
689 lines
23 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 System;
|
|
|
|
|
|
namespace XLua
|
|
{
|
|
public partial class ObjectTranslator
|
|
{
|
|
|
|
class IniterAdderUnityEngineVector2
|
|
{
|
|
static IniterAdderUnityEngineVector2()
|
|
{
|
|
LuaEnv.AddIniter(Init);
|
|
}
|
|
|
|
static void Init(LuaEnv luaenv, ObjectTranslator translator)
|
|
{
|
|
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector2>(translator.PushUnityEngineVector2, translator.Get, translator.UpdateUnityEngineVector2);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector3>(translator.PushUnityEngineVector3, translator.Get, translator.UpdateUnityEngineVector3);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector4>(translator.PushUnityEngineVector4, translator.Get, translator.UpdateUnityEngineVector4);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Color>(translator.PushUnityEngineColor, translator.Get, translator.UpdateUnityEngineColor);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Quaternion>(translator.PushUnityEngineQuaternion, translator.Get, translator.UpdateUnityEngineQuaternion);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Ray>(translator.PushUnityEngineRay, translator.Get, translator.UpdateUnityEngineRay);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Bounds>(translator.PushUnityEngineBounds, translator.Get, translator.UpdateUnityEngineBounds);
|
|
translator.RegisterPushAndGetAndUpdate<UnityEngine.Ray2D>(translator.PushUnityEngineRay2D, translator.Get, translator.UpdateUnityEngineRay2D);
|
|
|
|
}
|
|
}
|
|
|
|
static IniterAdderUnityEngineVector2 s_IniterAdderUnityEngineVector2_dumb_obj = new IniterAdderUnityEngineVector2();
|
|
static IniterAdderUnityEngineVector2 IniterAdderUnityEngineVector2_dumb_obj {get{return s_IniterAdderUnityEngineVector2_dumb_obj;}}
|
|
|
|
|
|
int UnityEngineVector2_TypeID = -1;
|
|
public void PushUnityEngineVector2(RealStatePtr L, UnityEngine.Vector2 val)
|
|
{
|
|
if (UnityEngineVector2_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineVector2_TypeID = getTypeId(L, typeof(UnityEngine.Vector2), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 8, UnityEngineVector2_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Vector2 ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Vector2 val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector2_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector2");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Vector2");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Vector2)objectCasters.GetCaster(typeof(UnityEngine.Vector2))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineVector2(RealStatePtr L, int index, UnityEngine.Vector2 val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector2_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector2");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Vector2 ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineVector3_TypeID = -1;
|
|
public void PushUnityEngineVector3(RealStatePtr L, UnityEngine.Vector3 val)
|
|
{
|
|
if (UnityEngineVector3_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineVector3_TypeID = getTypeId(L, typeof(UnityEngine.Vector3), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 12, UnityEngineVector3_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Vector3 ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Vector3 val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector3_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector3");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Vector3");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Vector3)objectCasters.GetCaster(typeof(UnityEngine.Vector3))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineVector3(RealStatePtr L, int index, UnityEngine.Vector3 val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector3_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector3");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Vector3 ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineVector4_TypeID = -1;
|
|
public void PushUnityEngineVector4(RealStatePtr L, UnityEngine.Vector4 val)
|
|
{
|
|
if (UnityEngineVector4_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineVector4_TypeID = getTypeId(L, typeof(UnityEngine.Vector4), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 16, UnityEngineVector4_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Vector4 ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Vector4 val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector4_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector4");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Vector4");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Vector4)objectCasters.GetCaster(typeof(UnityEngine.Vector4))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineVector4(RealStatePtr L, int index, UnityEngine.Vector4 val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineVector4_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Vector4");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Vector4 ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineColor_TypeID = -1;
|
|
public void PushUnityEngineColor(RealStatePtr L, UnityEngine.Color val)
|
|
{
|
|
if (UnityEngineColor_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineColor_TypeID = getTypeId(L, typeof(UnityEngine.Color), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 16, UnityEngineColor_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Color ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Color val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineColor_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Color");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Color");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Color)objectCasters.GetCaster(typeof(UnityEngine.Color))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineColor(RealStatePtr L, int index, UnityEngine.Color val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineColor_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Color");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Color ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineQuaternion_TypeID = -1;
|
|
public void PushUnityEngineQuaternion(RealStatePtr L, UnityEngine.Quaternion val)
|
|
{
|
|
if (UnityEngineQuaternion_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineQuaternion_TypeID = getTypeId(L, typeof(UnityEngine.Quaternion), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 16, UnityEngineQuaternion_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Quaternion ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Quaternion val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineQuaternion_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Quaternion");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Quaternion");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Quaternion)objectCasters.GetCaster(typeof(UnityEngine.Quaternion))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineQuaternion(RealStatePtr L, int index, UnityEngine.Quaternion val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineQuaternion_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Quaternion");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Quaternion ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineRay_TypeID = -1;
|
|
public void PushUnityEngineRay(RealStatePtr L, UnityEngine.Ray val)
|
|
{
|
|
if (UnityEngineRay_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineRay_TypeID = getTypeId(L, typeof(UnityEngine.Ray), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 24, UnityEngineRay_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Ray ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Ray val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Ray");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Ray");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Ray)objectCasters.GetCaster(typeof(UnityEngine.Ray))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineRay(RealStatePtr L, int index, UnityEngine.Ray val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Ray");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Ray ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineBounds_TypeID = -1;
|
|
public void PushUnityEngineBounds(RealStatePtr L, UnityEngine.Bounds val)
|
|
{
|
|
if (UnityEngineBounds_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineBounds_TypeID = getTypeId(L, typeof(UnityEngine.Bounds), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 24, UnityEngineBounds_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Bounds ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Bounds val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineBounds_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Bounds");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Bounds");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Bounds)objectCasters.GetCaster(typeof(UnityEngine.Bounds))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineBounds(RealStatePtr L, int index, UnityEngine.Bounds val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineBounds_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Bounds");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Bounds ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
int UnityEngineRay2D_TypeID = -1;
|
|
public void PushUnityEngineRay2D(RealStatePtr L, UnityEngine.Ray2D val)
|
|
{
|
|
if (UnityEngineRay2D_TypeID == -1)
|
|
{
|
|
bool is_first;
|
|
UnityEngineRay2D_TypeID = getTypeId(L, typeof(UnityEngine.Ray2D), out is_first);
|
|
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.xlua_pushstruct(L, 16, UnityEngineRay2D_TypeID);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail fail for UnityEngine.Ray2D ,value="+val);
|
|
}
|
|
|
|
}
|
|
|
|
public void Get(RealStatePtr L, int index, out UnityEngine.Ray2D val)
|
|
{
|
|
LuaTypes type = LuaAPI.lua_type(L, index);
|
|
if (type == LuaTypes.LUA_TUSERDATA )
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay2D_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Ray2D");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
|
|
{
|
|
throw new Exception("unpack fail for UnityEngine.Ray2D");
|
|
}
|
|
}
|
|
else if (type ==LuaTypes.LUA_TTABLE)
|
|
{
|
|
CopyByValue.UnPack(this, L, index, out val);
|
|
}
|
|
else
|
|
{
|
|
val = (UnityEngine.Ray2D)objectCasters.GetCaster(typeof(UnityEngine.Ray2D))(L, index, null);
|
|
}
|
|
}
|
|
|
|
public void UpdateUnityEngineRay2D(RealStatePtr L, int index, UnityEngine.Ray2D val)
|
|
{
|
|
|
|
if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
|
|
{
|
|
if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay2D_TypeID)
|
|
{
|
|
throw new Exception("invalid userdata for UnityEngine.Ray2D");
|
|
}
|
|
|
|
IntPtr buff = LuaAPI.lua_touserdata(L, index);
|
|
if (!CopyByValue.Pack(buff, 0, val))
|
|
{
|
|
throw new Exception("pack fail for UnityEngine.Ray2D ,value="+val);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
|
|
}
|
|
}
|
|
|
|
|
|
// table cast optimze
|
|
|
|
|
|
}
|
|
|
|
public partial class StaticLuaCallbacks
|
|
{
|
|
internal static bool __tryArrayGet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int index)
|
|
{
|
|
|
|
if (type == typeof(UnityEngine.Vector2[]))
|
|
{
|
|
UnityEngine.Vector2[] array = obj as UnityEngine.Vector2[];
|
|
translator.PushUnityEngineVector2(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Vector3[]))
|
|
{
|
|
UnityEngine.Vector3[] array = obj as UnityEngine.Vector3[];
|
|
translator.PushUnityEngineVector3(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Vector4[]))
|
|
{
|
|
UnityEngine.Vector4[] array = obj as UnityEngine.Vector4[];
|
|
translator.PushUnityEngineVector4(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Color[]))
|
|
{
|
|
UnityEngine.Color[] array = obj as UnityEngine.Color[];
|
|
translator.PushUnityEngineColor(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Quaternion[]))
|
|
{
|
|
UnityEngine.Quaternion[] array = obj as UnityEngine.Quaternion[];
|
|
translator.PushUnityEngineQuaternion(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Ray[]))
|
|
{
|
|
UnityEngine.Ray[] array = obj as UnityEngine.Ray[];
|
|
translator.PushUnityEngineRay(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Bounds[]))
|
|
{
|
|
UnityEngine.Bounds[] array = obj as UnityEngine.Bounds[];
|
|
translator.PushUnityEngineBounds(L, array[index]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Ray2D[]))
|
|
{
|
|
UnityEngine.Ray2D[] array = obj as UnityEngine.Ray2D[];
|
|
translator.PushUnityEngineRay2D(L, array[index]);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
internal static bool __tryArraySet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int array_idx, int obj_idx)
|
|
{
|
|
|
|
if (type == typeof(UnityEngine.Vector2[]))
|
|
{
|
|
UnityEngine.Vector2[] array = obj as UnityEngine.Vector2[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Vector3[]))
|
|
{
|
|
UnityEngine.Vector3[] array = obj as UnityEngine.Vector3[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Vector4[]))
|
|
{
|
|
UnityEngine.Vector4[] array = obj as UnityEngine.Vector4[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Color[]))
|
|
{
|
|
UnityEngine.Color[] array = obj as UnityEngine.Color[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Quaternion[]))
|
|
{
|
|
UnityEngine.Quaternion[] array = obj as UnityEngine.Quaternion[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Ray[]))
|
|
{
|
|
UnityEngine.Ray[] array = obj as UnityEngine.Ray[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Bounds[]))
|
|
{
|
|
UnityEngine.Bounds[] array = obj as UnityEngine.Bounds[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
else if (type == typeof(UnityEngine.Ray2D[]))
|
|
{
|
|
UnityEngine.Ray2D[] array = obj as UnityEngine.Ray2D[];
|
|
translator.Get(L, obj_idx, out array[array_idx]);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
} |