From 5635b0d770383333238f2dcdc0824392aefdc537 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 10 十二月 2018 11:39:55 +0800
Subject: [PATCH] 3335 准备跨服登录流程。

---
 Lua/Gen/GameNetSystemWrap.cs |  191 ++++++++++++++++++++++++++---------------------
 1 files changed, 106 insertions(+), 85 deletions(-)

diff --git a/Lua/Gen/GameNetSystemWrap.cs b/Lua/Gen/GameNetSystemWrap.cs
index 7ad24cd..ce14598 100644
--- a/Lua/Gen/GameNetSystemWrap.cs
+++ b/Lua/Gen/GameNetSystemWrap.cs
@@ -21,10 +21,12 @@
         {
 			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);
@@ -32,12 +34,12 @@
 			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);
             
@@ -98,11 +100,41 @@
             
                 
                 {
-                    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 );
                     
                     
                     
@@ -130,9 +162,9 @@
             
                 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 );
                     
                     
                     
@@ -158,6 +190,34 @@
         }
         
         [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 {
@@ -170,9 +230,10 @@
             
                 
                 {
-                    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 );
                     
                     
                     
@@ -338,13 +399,13 @@
         }
         
         [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);
             }
@@ -352,13 +413,41 @@
         }
         
         [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);
             }
@@ -385,74 +474,6 @@
         
 		
 		
-        [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;
-        }
-        
 		
 		
     }

--
Gitblit v1.8.0