524 lines
12 KiB
C#
524 lines
12 KiB
C#
//this source code was auto-generated by tolua#, do not modify it
|
|
using System;
|
|
using LuaInterface;
|
|
|
|
public class SocketClientWrap
|
|
{
|
|
public static void Register(LuaState L)
|
|
{
|
|
L.BeginClass(typeof(SocketClient), typeof(System.Object));
|
|
L.RegFunction("SetIpAddress", SetIpAddress);
|
|
L.RegFunction("Connect", Connect);
|
|
L.RegFunction("OnConnectFail", OnConnectFail);
|
|
L.RegFunction("AddStateInfo", AddStateInfo);
|
|
L.RegFunction("Close", Close);
|
|
L.RegFunction("Update", Update);
|
|
L.RegFunction("Disconnect", Disconnect);
|
|
L.RegFunction("TryConnect", TryConnect);
|
|
L.RegFunction("TryReconnect", TryReconnect);
|
|
L.RegFunction("Reconnect", Reconnect);
|
|
L.RegFunction("GetIPAddressType", GetIPAddressType);
|
|
L.RegFunction("OnReconnectFail", OnReconnectFail);
|
|
L.RegFunction("SendMessage", SendMessage);
|
|
L.RegFunction("SendHeartBeat", SendHeartBeat);
|
|
L.RegFunction("IsConnected", IsConnected);
|
|
L.RegFunction("RegistNetMessage", RegistNetMessage);
|
|
L.RegFunction("UnregistNetMessage", UnregistNetMessage);
|
|
L.RegFunction("SendMessageWithCallBack", SendMessageWithCallBack);
|
|
L.RegFunction("New", _CreateSocketClient);
|
|
L.RegFunction("__tostring", ToLua.op_ToString);
|
|
L.RegVar("netMgr", get_netMgr, set_netMgr);
|
|
L.RegVar("Error", get_Error, set_Error);
|
|
L.RegVar("CurMemoryStream", get_CurMemoryStream, null);
|
|
L.RegVar("CurReader", get_CurReader, null);
|
|
L.RegVar("IpAddress", get_IpAddress, null);
|
|
L.RegVar("Port", get_Port, null);
|
|
L.EndClass();
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _CreateSocketClient(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
int count = LuaDLL.lua_gettop(L);
|
|
|
|
if (count == 2)
|
|
{
|
|
string arg0 = ToLua.CheckString(L, 1);
|
|
int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
|
|
SocketClient obj = new SocketClient(arg0, arg1);
|
|
ToLua.PushObject(L, obj);
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: SocketClient.New");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int SetIpAddress(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 3);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
string arg0 = ToLua.CheckString(L, 2);
|
|
int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
|
|
obj.SetIpAddress(arg0, arg1);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int Connect(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.Connect();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int OnConnectFail(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.OnConnectFail();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int AddStateInfo(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 3);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
NetworkStateType arg0 = (NetworkStateType)ToLua.CheckObject(L, 2, typeof(NetworkStateType));
|
|
string arg1 = ToLua.CheckString(L, 3);
|
|
obj.AddStateInfo(arg0, arg1);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int Close(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.Close();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int Update(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.Update();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int Disconnect(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 2);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
string arg0 = ToLua.CheckString(L, 2);
|
|
obj.Disconnect(arg0);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int TryConnect(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.TryConnect();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int TryReconnect(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.TryReconnect();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int Reconnect(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.Reconnect();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int GetIPAddressType(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 2);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
string arg0 = ToLua.CheckString(L, 2);
|
|
System.Net.Sockets.AddressFamily o = obj.GetIPAddressType(arg0);
|
|
ToLua.Push(L, o);
|
|
return 1;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int OnReconnectFail(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.OnReconnectFail();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int SendMessage(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 3);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
|
|
GameLogic.ByteBuffer arg1 = (GameLogic.ByteBuffer)ToLua.CheckObject<GameLogic.ByteBuffer>(L, 3);
|
|
obj.SendMessage(arg0, arg1);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int SendHeartBeat(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
obj.SendHeartBeat();
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int IsConnected(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 1);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
bool o = obj.IsConnected();
|
|
LuaDLL.lua_pushboolean(L, o);
|
|
return 1;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int RegistNetMessage(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 3);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
|
|
System.Action<GameLogic.ByteBuffer> arg1 = (System.Action<GameLogic.ByteBuffer>)ToLua.CheckDelegate<System.Action<GameLogic.ByteBuffer>>(L, 3);
|
|
obj.RegistNetMessage(arg0, arg1);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int UnregistNetMessage(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 3);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
|
|
System.Action<GameLogic.ByteBuffer> arg1 = (System.Action<GameLogic.ByteBuffer>)ToLua.CheckDelegate<System.Action<GameLogic.ByteBuffer>>(L, 3);
|
|
obj.UnregistNetMessage(arg0, arg1);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int SendMessageWithCallBack(IntPtr L)
|
|
{
|
|
try
|
|
{
|
|
ToLua.CheckArgsCount(L, 5);
|
|
SocketClient obj = (SocketClient)ToLua.CheckObject<SocketClient>(L, 1);
|
|
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
|
|
int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
|
|
GameLogic.ByteBuffer arg2 = (GameLogic.ByteBuffer)ToLua.CheckObject<GameLogic.ByteBuffer>(L, 4);
|
|
LuaFunction arg3 = ToLua.CheckLuaFunction(L, 5);
|
|
obj.SendMessageWithCallBack(arg0, arg1, arg2, arg3);
|
|
return 0;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e);
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_netMgr(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
GameLogic.NetworkManager ret = obj.netMgr;
|
|
ToLua.Push(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index netMgr on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_Error(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
string ret = obj.Error;
|
|
LuaDLL.lua_pushstring(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Error on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_CurMemoryStream(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
System.IO.MemoryStream ret = obj.CurMemoryStream;
|
|
ToLua.PushObject(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index CurMemoryStream on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_CurReader(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
System.IO.BinaryReader ret = obj.CurReader;
|
|
ToLua.PushObject(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index CurReader on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_IpAddress(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
string ret = obj.IpAddress;
|
|
LuaDLL.lua_pushstring(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index IpAddress on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int get_Port(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
int ret = obj.Port;
|
|
LuaDLL.lua_pushinteger(L, ret);
|
|
return 1;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Port on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int set_netMgr(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
GameLogic.NetworkManager arg0 = (GameLogic.NetworkManager)ToLua.CheckObject<GameLogic.NetworkManager>(L, 2);
|
|
obj.netMgr = arg0;
|
|
return 0;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index netMgr on a nil value");
|
|
}
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int set_Error(IntPtr L)
|
|
{
|
|
object o = null;
|
|
|
|
try
|
|
{
|
|
o = ToLua.ToObject(L, 1);
|
|
SocketClient obj = (SocketClient)o;
|
|
string arg0 = ToLua.CheckString(L, 2);
|
|
obj.Error = arg0;
|
|
return 0;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Error on a nil value");
|
|
}
|
|
}
|
|
}
|
|
|