//this source code was auto-generated by tolua#, do not modify it
using System;
using LuaInterface;

public class ClientNetWrap
{
	public static void Register(LuaState L)
	{
		L.BeginClass(typeof(ClientNet), typeof(UnityEngine.MonoBehaviour));
		L.RegFunction("Init", Init);
		L.RegFunction("Connect", Connect);
		L.RegFunction("Send", Send);
		L.RegFunction("Resend", Resend);
		L.RegFunction("GetNextSession", GetNextSession);
		L.RegFunction("AddNetStateListener", AddNetStateListener);
		L.RegFunction("Disconnect", Disconnect);
		L.RegFunction("Close", Close);
		L.RegFunction("checkIfHasCachePacks", checkIfHasCachePacks);
		L.RegFunction("ClearMsgQueue", ClearMsgQueue);
		L.RegFunction("__eq", op_Equality);
		L.RegFunction("__tostring", ToLua.op_ToString);
		L.RegVar("isConnect", get_isConnect, null);
		L.RegVar("resendTarget", get_resendTarget, set_resendTarget);
		L.RegVar("enableCrypt", get_enableCrypt, set_enableCrypt);
		L.RegVar("instance", get_instance, null);
		L.EndClass();
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Init(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			obj.Init();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Connect(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 4);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			string arg0 = ToLua.CheckString(L, 2);
			int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
			bool arg2 = LuaDLL.luaL_checkboolean(L, 4);
			bool o = obj.Connect(arg0, arg1, arg2);
			LuaDLL.lua_pushboolean(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Send(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(ClientNet), typeof(string), typeof(SpObject)))
			{
				ClientNet obj = (ClientNet)ToLua.ToObject(L, 1);
				string arg0 = ToLua.ToString(L, 2);
				SpObject arg1 = (SpObject)ToLua.ToObject(L, 3);
				obj.Send(arg0, arg1);
				return 0;
			}
			else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(ClientNet), typeof(string), typeof(SpObject), typeof(System.Action<string,SpObject>)))
			{
				ClientNet obj = (ClientNet)ToLua.ToObject(L, 1);
				string arg0 = ToLua.ToString(L, 2);
				SpObject arg1 = (SpObject)ToLua.ToObject(L, 3);
				System.Action<string,SpObject> arg2 = null;
				LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

				if (funcType4 != LuaTypes.LUA_TFUNCTION)
				{
					 arg2 = (System.Action<string,SpObject>)ToLua.ToObject(L, 4);
				}
				else
				{
					LuaFunction func = ToLua.ToLuaFunction(L, 4);
					arg2 = DelegateFactory.CreateDelegate(typeof(System.Action<string,SpObject>), func) as System.Action<string,SpObject>;
				}

				obj.Send(arg0, arg1, arg2);
				return 0;
			}
			else if (count == 6 && TypeChecker.CheckTypes(L, 1, typeof(ClientNet), typeof(string), typeof(byte[]), typeof(int), typeof(int), typeof(int)))
			{
				ClientNet obj = (ClientNet)ToLua.ToObject(L, 1);
				string arg0 = ToLua.ToString(L, 2);
				byte[] arg1 = ToLua.CheckByteBuffer(L, 3);
				int arg2 = (int)LuaDLL.lua_tonumber(L, 4);
				int arg3 = (int)LuaDLL.lua_tonumber(L, 5);
				int arg4 = (int)LuaDLL.lua_tonumber(L, 6);
				obj.Send(arg0, arg1, arg2, arg3, arg4);
				return 0;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: ClientNet.Send");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Resend(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
			obj.Resend(arg0);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetNextSession(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			int o = obj.GetNextSession();
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int AddNetStateListener(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			INetStateListener arg0 = (INetStateListener)ToLua.CheckObject(L, 2, typeof(INetStateListener));
			obj.AddNetStateListener(arg0);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Disconnect(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			obj.Disconnect();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Close(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			obj.Close();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int checkIfHasCachePacks(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			bool o = obj.checkIfHasCachePacks();
			LuaDLL.lua_pushboolean(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int ClearMsgQueue(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			ClientNet obj = (ClientNet)ToLua.CheckObject(L, 1, typeof(ClientNet));
			obj.ClearMsgQueue();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int op_Equality(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1);
			UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2);
			bool o = arg0 == arg1;
			LuaDLL.lua_pushboolean(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_isConnect(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			ClientNet obj = (ClientNet)o;
			bool ret = obj.isConnect;
			LuaDLL.lua_pushboolean(L, ret);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index isConnect on a nil value" : e.Message);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_resendTarget(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			ClientNet obj = (ClientNet)o;
			string ret = obj.resendTarget;
			LuaDLL.lua_pushstring(L, ret);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index resendTarget on a nil value" : e.Message);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_enableCrypt(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			ClientNet obj = (ClientNet)o;
			bool ret = obj.enableCrypt;
			LuaDLL.lua_pushboolean(L, ret);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index enableCrypt on a nil value" : e.Message);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_instance(IntPtr L)
	{
		try
		{
			ToLua.Push(L, ClientNet.instance);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_resendTarget(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			ClientNet obj = (ClientNet)o;
			string arg0 = ToLua.CheckString(L, 2);
			obj.resendTarget = arg0;
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index resendTarget on a nil value" : e.Message);
		}
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_enableCrypt(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			ClientNet obj = (ClientNet)o;
			bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
			obj.enableCrypt = arg0;
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index enableCrypt on a nil value" : e.Message);
		}
	}
}

