Ejemplo n.º 1
0
        //清数据
        public void Dispose()
        {
            disposed = true;
            EventSystem.RemoveEvent(EventID.SOKECT_CONNECT_RESULT, OnEventSocketConnectOK);
            //MsgCallManager.RemoveCallback(ProtoID.SC_LOGIN_RECONNECTION_REPLY, ReconnectSuccess);
            if (heartBeatCheck != null)
            {
                heartBeatCheck.Dispose();
            }
            heartBeatCheck = null;
            if (clientSocket != null)
            {
                clientSocket.Dispose();
            }
            clientSocket = null;
            if (clientProtoMsg != null)
            {
                clientProtoMsg.Dispose();
            }
            clientProtoMsg = null;
//             if (msgCacheMgr != null)
//              msgCacheMgr.Dispose ();
//          msgCacheMgr = null;
            if (msgVerifyMgr != null)
            {
                msgVerifyMgr.Dispose();
            }
            msgVerifyMgr = null;
        }
Ejemplo n.º 2
0
        public void Init()
        {
            Dispose();
            disposed = false;

            //创建相关容器
            clientSocket   = new ClientSocket();           //只有发重连消息时,才能换socket。
            clientProtoMsg = new ClientProtoMsg();
            heartBeatCheck = new HeartBeat();
            //msgCacheMgr = new MsgCacheManager();
            msgVerifyMgr = new MsgVerifyManager();

            //注册相关事件
            EventSystem.RegisterEvent(EventID.SOKECT_CONNECT_RESULT, OnEventSocketConnectOK);
            //MsgCallManager.AddCallback(ProtoID.SC_LOGIN_RECONNECTION_REPLY, ReconnectSuccess);
            //响应相关消息
        }