From 89343a7a0909e5244a3b69c4db1294de4536243b Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期一, 15 十二月 2025 18:15:22 +0800
Subject: [PATCH] 262 幻境阁系统-客户端 新增仅适用武将解锁的头像和形象的红点移除规则

---
 Main/Core/NetworkPackage/GameNetSystem.cs |  227 +++++++++++++++-----------------------------------------
 1 files changed, 63 insertions(+), 164 deletions(-)

diff --git a/Main/Core/NetworkPackage/GameNetSystem.cs b/Main/Core/NetworkPackage/GameNetSystem.cs
index f67a17b..a0661a3 100644
--- a/Main/Core/NetworkPackage/GameNetSystem.cs
+++ b/Main/Core/NetworkPackage/GameNetSystem.cs
@@ -6,7 +6,11 @@
 
 public class GameNetSystem : Singleton<GameNetSystem>
 {
-    // NetUpdateBehaviour m_NetUpdateBehaviour;
+    //闄愬埗瀹㈡埛绔殑涓嬩竴涓寘鏄櫥褰曞寘C0101_tagCPlayerLogin锛屽鏋滀笉鏄櫥褰曞寘涓嶅厑璁稿彂閫�
+    bool waitLogin = false; //绛夊緟鍙戦�佺櫥褰曞寘锛屽鏋滄湁鍏朵粬鍖呯洿鎺ュ睆钄斤紝閬垮厤鏂嚎閲嶈繛鐨勬儏鍐靛彂浜嗘敾鍑诲寘涔嬬被鐨�
+    //绛夊緟鏈嶅姟绔�0403鐨勫寘鍚庢墠鑳藉彂鍏朵粬鐨勫姛鑳藉寘锛屽彧鏈塁0123_tagCClientPackVersion 鍜� C0101_tagCPlayerLogin 鍙互鍙戦��  
+    bool waitLoginMap = false; 
+    NetUpdateBehaviour m_NetUpdateBehaviour;
     NeverConnectState neverConnectState;
     AccountLoginState accountLoginState;
     // CreateOrSelectRoleState createOrSelectRoleState;
@@ -78,26 +82,16 @@
         get { return mainSocket == null ? Time.time : (float)(DateTime.Now - mainSocket.lastPackageTime).TotalSeconds; }
     }
 
-    public bool crossServerConnected_Loigc { get; set; }
-    private ClientSocket crossServerSocket;
-    public bool crossServerSocketConnected { get { return crossServerConnected_Loigc && (crossServerSocket == null ? false : crossServerSocket.connected); } }
-
-    public float timeSinceCrossServerSocketLastProtocol
-    {
-        get { return crossServerSocket == null ? Time.time : (float)(DateTime.Now - crossServerSocket.lastPackageTime).TotalSeconds; }
-    }
 
     Queue<GameNetPackBasic> mainProtocolQueue = new Queue<GameNetPackBasic>();
-    Queue<GameNetPackBasic> crossSeverProtocolQueue = new Queue<GameNetPackBasic>();
 
-    public CrossServerData crossServerData { get; private set; }
 
     public GameNetSystem()
     {
         var gameObject = new GameObject("NetUpdateBehaviour");
         GameObject.DontDestroyOnLoad(gameObject);
-        // m_NetUpdateBehaviour = gameObject.AddComponent<NetUpdateBehaviour>();
-        // m_NetUpdateBehaviour.RegisterUpdateCallBack(OnUpdate);
+        m_NetUpdateBehaviour = gameObject.AddComponent<NetUpdateBehaviour>();
+        m_NetUpdateBehaviour.RegisterUpdateCallBack(OnUpdate);
 
         neverConnectState = gameObject.AddComponent<NeverConnectState>();
         accountLoginState = gameObject.AddComponent<AccountLoginState>();
@@ -135,43 +129,61 @@
         });
     }
 
-    public void BeginConnectCrossServer(string ip, int port, Action<bool> onConnected)
+    //闄愬埗瀹㈡埛绔殑涓嬩竴涓寘鏄櫥褰曞寘C0101_tagCPlayerLogin锛屽鏋滀笉鏄櫥褰曞寘涓嶅厑璁稿彂閫�
+    public void SetIsWaitLogin(bool _wait)
     {
-        try
-        {
-            crossServerConnected_Loigc = false;
-            if (crossServerSocketConnected)
-            {
-                crossServerSocket.CloseConnect();
-            }
-        }
-        catch (System.Exception ex)
-        {
-            Debug.Log(ex);
-        }
-
-        crossServerSocket = new ClientSocket(ServerType.CrossSever);
-        crossSeverProtocolQueue.Clear();
-        this.crossServerSocket.Connect(ip, port, (bool ok) =>
-        {
-            if (onConnected != null)
-            {
-                onConnected(ok);
-            }
-        });
+        waitLogin = _wait;
     }
 
-    public void UpdateCrossServerData(string ip, int port, byte state)
+    //绛夊緟鏈嶅姟绔�0403鐨勫寘鍚庢墠鑳藉彂鍏朵粬鐨勫姛鑳藉寘锛屽彧鏈塁0123_tagCClientPackVersion 鍜� C0101_tagCPlayerLogin 鍙互鍙戦��
+    public void SetIsWaitLoginMap(bool _wait)
     {
-        this.crossServerData = new CrossServerData(ip, port, state);
-        if (this.crossServerData.crossState == 0)
+        waitLoginMap = _wait;
+    }
+
+    public bool GetIsWaitLoginMap()
+    {
+        return waitLoginMap;
+    }
+
+    //0403鐧诲綍涔嬪墠鐨勫寘缂撳瓨
+    Queue<GameNetPackBasic> sendQueue = new Queue<GameNetPackBasic>();
+
+    public void SendCachePackage()
+    {
+        int cnt = sendQueue.Count;
+        if (mainSocket != null)
         {
-            crossServerConnected_Loigc = false;
+            while (sendQueue.Count > 0)
+            {
+                SendInfo(sendQueue.Dequeue());
+            }
         }
+        Debug.LogError($"閲嶇偣鎻愰啋锛�0403鐧诲綍鍚� 鍙戦�佺紦瀛樺寘鏁伴噺 {cnt} 涓�");
     }
 
     public void SendInfo(GameNetPackBasic protocol)
     {
+        if (waitLogin)
+        {
+            if (protocol is not C0101_tagCPlayerLogin)
+            {
+                Debug.LogWarning("绛夊緟鎵ц鐧诲綍锛屼笉鍏佽鍙戦�佸叾浠栧寘 " + protocol.ToString());
+                return;
+            }
+        }
+
+        // 0102鏄粠鍦板浘鍙戦�佺殑 璇存槑宸茬櫥褰曪紝浣嗗彲鑳藉崱椤垮鑷撮�氱煡route鐘舵�佹參浜庡鎴风锛屼緷鐒堕渶瑕侀槻鑼�
+        if (waitLoginMap)
+        {
+            if (protocol is not C0123_tagCClientPackVersion && protocol is not C0101_tagCPlayerLogin)
+            {
+                Debug.LogError("閲嶇偣鎻愰啋锛氱櫥褰曞畬鎴愬墠鐨勫皝鍖呭厛鍔犲叆闃熷垪 绛�0403鍥炲寘鍚庡啀涓�璧峰彂閫佹湇鍔$ " + protocol.ToString());
+                sendQueue.Enqueue(protocol);
+                return;
+            }
+        }
+
         if (mainSocket != null)
         {
             mainSocket.SendInfo(protocol);
@@ -187,15 +199,6 @@
         }
     }
 
-    public void SendToCrossServer(GameNetPackBasic protocol)
-    {
-        if (crossServerSocket != null)
-        {
-            protocol.socketType = ServerType.CrossSever;
-            crossServerSocket.SendInfo(protocol);
-            DebugPkgCache.Push(protocol);
-        }
-    }
 
     public void PushPackage(GameNetPackBasic protocol, ServerType type)
     {
@@ -208,17 +211,7 @@
 
             if (PackageRegedit.Contain(protocol.cmd))
             {
-                switch (type)
-                {
-                    case ServerType.Main:
-                        mainProtocolQueue.Enqueue(protocol);
-                        break;
-                    case ServerType.CrossSever:
-                        crossSeverProtocolQueue.Enqueue(protocol);
-                        break;
-                    default:
-                        break;
-                }
+                mainProtocolQueue.Enqueue(protocol);
 
                 DebugPkgCache.Push(protocol);
             }
@@ -238,13 +231,7 @@
                 mainSocket.CloseConnect();
             }
 
-            if (crossServerSocket != null)
-            {
-                crossServerSocket.CloseConnect();
-            }
-
             mainProtocolQueue.Clear();
-            crossSeverProtocolQueue.Clear();
         }
         catch (Exception ex)
         {
@@ -253,32 +240,11 @@
         finally
         {
             netState = NetState.DisConnected;
-            // var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
-            // loginModel.busy = false;
-            // CrossServerLogin.Instance.busy = false;
+            LoginManager.Instance.busy = false;
         }
     }
 
-    public void DisconnectCrossServer()
-    {
-        try
-        {
-            if (crossServerSocket != null)
-            {
-                crossServerSocket.CloseConnect();
-            }
 
-            crossSeverProtocolQueue.Clear();
-        }
-        catch (Exception ex)
-        {
-            Debug.Log(ex);
-        }
-        finally
-        {
-            // CrossServerLogin.Instance.busy = false;
-        }
-    }
 
     public void Reconnect()
     {
@@ -289,13 +255,7 @@
                 mainSocket.CloseConnect();
             }
 
-            if (crossServerSocket != null)
-            {
-                crossServerSocket.CloseConnect();
-            }
-
             mainProtocolQueue.Clear();
-            crossSeverProtocolQueue.Clear();
         }
         catch (Exception ex)
         {
@@ -304,36 +264,23 @@
         finally
         {
             netState = NetState.AccountLogin;
-            // CrossServerLogin.Instance.busy = false;
-            // var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
-            // loginModel.busy = false;
-            // loginModel.ReAccountLogin();
+            LoginManager.Instance.busy = false;
+            LoginManager.Instance.ReAccountLogin();
         }
     }
 
     public void LoginOut()
     {
-        // if (CameraController.Instance != null)
-        //     CameraController.Instance.SetInGame(false);
-        // DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize = false;
-
         try
         {
-            // ynmbxxjUtil.Instance.RoleLoginOut();
-            crossServerConnected_Loigc = false;
+            SDKUtils.Instance.RoleLoginOut();
 
             if (mainSocket != null)
             {
                 mainSocket.CloseConnect();
             }
 
-            if (crossServerSocket != null)
-            {
-                crossServerSocket.CloseConnect();
-            }
-
             mainProtocolQueue.Clear();
-            crossSeverProtocolQueue.Clear();
         }
         catch (Exception ex)
         {
@@ -342,32 +289,11 @@
         finally
         {
             netState = NetState.NerverConnect;
-            // CrossServerLogin.Instance.busy = false;
-            // //ArenaManager.isArenaClient = false;
-            // var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
-            // loginModel.busy = false;
-            // WindowJumpMgr.Instance.ClearJumpData();
 
-            // StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
-            // {
-            //     toMapId = 1,
-            //     toLineId = 0,
-            //     needEmpty = false,
-            //     needLoadResource = true,
-            //     serverType = ServerType.Main,
-            //     isClientLoadMap = true
-            // });
-            // //CameraManager.uiCamera.clearFlags = CameraClearFlags.SolidColor;
-            // //GameObject obj = GameObject.Find("NormalCanvas");
-            // //int count = obj.transform.childCount;
-            // //for (int i = count - 1; i >= 0; --i)
-            // //{
-            // //    //Debug.LogError(obj.transform.GetChild(i).name);
-            // //    GameObject.Destroy(obj.transform.GetChild(i).gameObject);
-            // //}
-            // //SceneManager.LoadScene("Empty");
-            // NetLinkWin.Hide();
-            // DTC0403_tagPlayerLoginLoadOK.neverLoginOk = true;
+            LoginManager.Instance.busy = false;
+
+            StageManager.Instance.ReturnToLoginScene();
+            NetLinkWin.Hide();
         }
     }
 
@@ -393,14 +319,6 @@
                     PackageRegedit.Distribute(package);
                 }
             }
-            while (crossSeverProtocolQueue.Count > 0)
-            {
-                var package = crossSeverProtocolQueue.Dequeue();
-                if (package != null)
-                {
-                    PackageRegedit.Distribute(package);
-                }
-            }
         }
 
     }
@@ -415,31 +333,12 @@
         DisConnected = 6,
     }
 
-    public struct CrossServerData
-    {
-        public string ip;
-        public int port;
-        public CrossServerState crossState;
-
-        public CrossServerData(string ip, int port, byte state)
-        {
-            this.ip = ip;
-            this.port = port;
-            this.crossState = (CrossServerState)state;
-        }
-    }
-
-    public enum CrossServerState
-    {
-        No = 0,
-        Yes = 1,
-        Error = 2,
-    }
 
 }
 
 public enum ServerType
 {
     Main = 1,
-    CrossSever = 2,
+    B430 = 2,
+    MainFight = 3,
 }

--
Gitblit v1.8.0