| | |
| | | |
| | | public class GameNetSystem : Singleton<GameNetSystem> |
| | | { |
| | | //限制客户端的下一个包是登录包C0101_tagCPlayerLogin,如果不是登录包不允许发送 |
| | | bool waitLogin = false; //等待发送登录包,如果有其他包直接屏蔽,避免断线重连的情况发了攻击包之类的 |
| | | //等待服务端0403的包后才能发其他的功能包,只有C0123_tagCClientPackVersion 和 C0101_tagCPlayerLogin 可以发送 |
| | | bool waitLoginMap = false; |
| | | NetUpdateBehaviour m_NetUpdateBehaviour; |
| | | NeverConnectState neverConnectState; |
| | | AccountLoginState accountLoginState; |
| | |
| | | }); |
| | | } |
| | | |
| | | //限制客户端的下一个包是登录包C0101_tagCPlayerLogin,如果不是登录包不允许发送 |
| | | public void SetIsWaitLogin(bool _wait) |
| | | { |
| | | waitLogin = _wait; |
| | | } |
| | | |
| | | //等待服务端0403的包后才能发其他的功能包,只有C0123_tagCClientPackVersion 和 C0101_tagCPlayerLogin 可以发送 |
| | | public void SetIsWaitLoginMap(bool _wait) |
| | | { |
| | | waitLoginMap = _wait; |
| | | } |
| | | |
| | | public void SendInfo(GameNetPackBasic protocol) |
| | | { |
| | | if (waitLogin) |
| | | { |
| | | if (protocol is not C0101_tagCPlayerLogin) |
| | | { |
| | | Debug.LogWarning("等待执行登录,不允许发送其他包 " + protocol.ToString()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (waitLoginMap) |
| | | { |
| | | if (protocol is not C0123_tagCClientPackVersion && protocol is not C0101_tagCPlayerLogin) |
| | | { |
| | | Debug.LogWarning("等待0403包,不允许发送其他包 " + protocol.ToString()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (mainSocket != null) |
| | | { |
| | | mainSocket.SendInfo(protocol); |