示例#1
0
        public void ConnectCallback(IAsyncResult ar)
        {
            if (ar.IsCompleted)
            {
                m_bConnecting = false;

                try
                {
                    m_CliSocket.EndConnect(ar);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                    //Debug.LogError( "Connect callback exception " + e.ToString() );
                    ReinitSocket();
                }

                INetWorkMessage msg = new GAMEMSG_SYSTEM_connect(m_CliSocket.Connected);
                m_ReadMsgQueue.Enqueue(msg);

                if (m_CliSocket.Connected)
                {
                    Debug.Log(" Server connect suc");
                    BeginRecv();
                }
                else
                {
                    Debug.Log(" Server connect fail");
                }
            }
        }
示例#2
0
        void OnConnected(GameMsgBase msg)
        {
            GAMEMSG_SYSTEM_connect connMsg = msg as GAMEMSG_SYSTEM_connect;

            if (connMsg != null)
            {
                if (!connMsg.m_bSucceed)
                {
                    //string strTips = SystemTips.GetTipsContent("All_ConnectFail");
                    //GameExitControl.ShowYesBox(strTips, null);
                }
                else
                {
                    NetworkMgr.SendLoginMessage();
                }
            }
        }