#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, 3, 1); Utils.RegisterFunc(L, Utils.METHOD_IDX, "BeginConnectGameServer", _m_BeginConnectGameServer); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SendInfo", _m_SendInfo); 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.METHOD_IDX, "disconnectEvent", _e_disconnectEvent); Utils.RegisterFunc(L, Utils.METHOD_IDX, "connectedEvent", _e_connectedEvent); Utils.RegisterFunc(L, Utils.GETTER_IDX, "netState", _g_get_netState); Utils.RegisterFunc(L, Utils.GETTER_IDX, "socketConnected", _g_get_socketConnected); Utils.RegisterFunc(L, Utils.GETTER_IDX, "lastPackageTime", _g_get_lastPackageTime); 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(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_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(L, 2)) { GameNetPackBasic _vNetPack = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); gen_to_be_invoked.SendInfo( _vNetPack ); 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_PushPackage(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1); { GameNetPackBasic __package = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); gen_to_be_invoked.PushPackage( __package ); 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_socketConnected(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.socketConnected); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_lastPackageTime(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.lastPackageTime); } 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; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_disconnectEvent(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.disconnectEvent += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.disconnectEvent -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to GameNetSystem.disconnectEvent!"); return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_connectedEvent(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); GameNetSystem gen_to_be_invoked = (GameNetSystem)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.connectedEvent += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.connectedEvent -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to GameNetSystem.connectedEvent!"); return 0; } } }