#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 GameNetSystemWrap
|
{
|
public static void __Register(RealStatePtr L)
|
{
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
System.Type type = typeof(GameNetSystem);
|
Utils.BeginObjectRegister(type, L, translator, 0, 10, 5, 1);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "BeginConnectGameServer", _m_BeginConnectGameServer);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "BeginConnectCrossServer", _m_BeginConnectCrossServer);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SendInfo", _m_SendInfo);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SendToCrossServer", _m_SendToCrossServer);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "PushPackage", _m_PushPackage);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Disconnect", _m_Disconnect);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Reconnect", _m_Reconnect);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoginOut", _m_LoginOut);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnAccountLogin", _m_OnAccountLogin);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnEnterWorld", _m_OnEnterWorld);
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "netState", _g_get_netState);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "mainSocketConnected", _g_get_mainSocketConnected);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "timeSinceMainSocketLastProtocol", _g_get_timeSinceMainSocketLastProtocol);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "crossServerSocketConnected", _g_get_crossServerSocketConnected);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "timeSinceCrossServerSocketLastProtocol", _g_get_timeSinceCrossServerSocketLastProtocol);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "netState", _s_set_netState);
|
|
|
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)
|
{
|
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
if(LuaAPI.lua_gettop(L) == 1)
|
{
|
|
GameNetSystem gen_ret = new GameNetSystem();
|
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 GameNetSystem constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_BeginConnectGameServer(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
string _ip = LuaAPI.lua_tostring(L, 2);
|
int _port = LuaAPI.xlua_tointeger(L, 3);
|
System.Action _onConnected = translator.GetDelegate<System.Action>(L, 4);
|
|
gen_to_be_invoked.BeginConnectGameServer( _ip, _port, _onConnected );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_BeginConnectCrossServer(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
string _ip = LuaAPI.lua_tostring(L, 2);
|
int _port = LuaAPI.xlua_tointeger(L, 3);
|
System.Action _onConnected = translator.GetDelegate<System.Action>(L, 4);
|
|
gen_to_be_invoked.BeginConnectCrossServer( _ip, _port, _onConnected );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_SendInfo(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
if(gen_param_count == 2&& translator.Assignable<GameNetPackBasic>(L, 2))
|
{
|
GameNetPackBasic _protocol = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic));
|
|
gen_to_be_invoked.SendInfo( _protocol );
|
|
|
|
return 0;
|
}
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
{
|
byte[] _vBytes = LuaAPI.lua_tobytes(L, 2);
|
|
gen_to_be_invoked.SendInfo( _vBytes );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to GameNetSystem.SendInfo!");
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_SendToCrossServer(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
GameNetPackBasic _protocol = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic));
|
|
gen_to_be_invoked.SendToCrossServer( _protocol );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_PushPackage(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
GameNetPackBasic _protocol = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic));
|
GameNetSystem.SocketType _type;translator.Get(L, 3, out _type);
|
|
gen_to_be_invoked.PushPackage( _protocol, _type );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_Disconnect(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
|
gen_to_be_invoked.Disconnect( );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_Reconnect(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
|
gen_to_be_invoked.Reconnect( );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_LoginOut(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
|
gen_to_be_invoked.LoginOut( );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_OnAccountLogin(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
|
gen_to_be_invoked.OnAccountLogin( );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _m_OnEnterWorld(RealStatePtr L)
|
{
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
|
|
|
{
|
|
gen_to_be_invoked.OnEnterWorld( );
|
|
|
|
return 0;
|
}
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
|
}
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_netState(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
translator.Push(L, gen_to_be_invoked.netState);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_mainSocketConnected(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.mainSocketConnected);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_timeSinceMainSocketLastProtocol(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.timeSinceMainSocketLastProtocol);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_crossServerSocketConnected(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.crossServerSocketConnected);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _g_get_timeSinceCrossServerSocketLastProtocol(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.timeSinceCrossServerSocketLastProtocol);
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 1;
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
static int _s_set_netState(RealStatePtr L)
|
{
|
try {
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1);
|
GameNetSystem.NetState gen_value;translator.Get(L, 2, out gen_value);
|
gen_to_be_invoked.netState = gen_value;
|
|
} catch(System.Exception gen_e) {
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
}
|
return 0;
|
}
|
|
|
|
|
|
}
|
}
|