| | |
| | | { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | System.Type type = typeof(GameNetSystem); |
| | | Utils.BeginObjectRegister(type, L, translator, 0, 10, 3, 1); |
| | | 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, "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.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); |
| | | |
| | |
| | | |
| | | |
| | | { |
| | | string __ip = LuaAPI.lua_tostring(L, 2); |
| | | int __port = LuaAPI.xlua_tointeger(L, 3); |
| | | System.Action __onConnected = translator.GetDelegate<System.Action>(L, 4); |
| | | 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 ); |
| | | 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 ); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | if(gen_param_count == 2&& translator.Assignable<GameNetPackBasic>(L, 2)) |
| | | { |
| | | GameNetPackBasic _vNetPack = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); |
| | | GameNetPackBasic _protocol = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); |
| | | |
| | | gen_to_be_invoked.SendInfo( _vNetPack ); |
| | | gen_to_be_invoked.SendInfo( _protocol ); |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | [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 { |
| | |
| | | |
| | | |
| | | { |
| | | GameNetPackBasic __package = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); |
| | | GameNetPackBasic _protocol = (GameNetPackBasic)translator.GetObject(L, 2, typeof(GameNetPackBasic)); |
| | | GameNetSystem.SocketType _type;translator.Get(L, 3, out _type); |
| | | |
| | | gen_to_be_invoked.PushPackage( __package ); |
| | | gen_to_be_invoked.PushPackage( _protocol, _type ); |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _g_get_socketConnected(RealStatePtr L) |
| | | 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.socketConnected); |
| | | LuaAPI.lua_pushboolean(L, gen_to_be_invoked.mainSocketConnected); |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | | } |
| | |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _g_get_lastPackageTime(RealStatePtr L) |
| | | static int _g_get_timeSinceMainSocketLastProtocol(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); |
| | | 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); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | [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<System.Action>(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<System.Action>(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; |
| | | } |
| | | |
| | | |
| | | |
| | | } |