hch
5 天以前 be6ae7d3819761fa1126ebf1b8db97c10dd2830c
0312 登录完成前缓存封包处理
2个文件已修改
41 ■■■■ 已修改文件
Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/GameNetSystem.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs
@@ -16,6 +16,7 @@
        GameNetSystem.Instance.netState = GameNetSystem.NetState.Connected;
        GameNetSystem.Instance.SetIsWaitLoginMap(false);
        GameNetSystem.Instance.SendCachePackage();
        NetLinkWin.Hide();
        if (LoginManager.Instance.reconnectBackGround)
Main/Core/NetworkPackage/GameNetSystem.cs
@@ -141,6 +141,27 @@
        waitLoginMap = _wait;
    }
    public bool GetIsWaitLoginMap()
    {
        return waitLoginMap;
    }
    //0403登录之前的包缓存
    Queue<GameNetPackBasic> sendQueue = new Queue<GameNetPackBasic>();
    public void SendCachePackage()
    {
        int cnt = sendQueue.Count;
        if (mainSocket != null)
        {
            while (sendQueue.Count > 0)
            {
                SendInfo(sendQueue.Dequeue());
            }
        }
        Debug.LogError($"重点提醒:0403登录后 发送缓存包数量 {cnt} 个");
    }
    public void SendInfo(GameNetPackBasic protocol)
    {
        if (waitLogin)
@@ -152,15 +173,16 @@
            }
        }
        // 0102是从地图发送的 说明已登录,除非服务端报错异常,这里可以不屏蔽
        // if (waitLoginMap)
        // {
        //     if (protocol is not C0123_tagCClientPackVersion && protocol is not C0101_tagCPlayerLogin)
        //     {
        //         Debug.LogError("等待0403包,不允许发送其他包 " + 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)
        {