public void CloseNotCallback() { Connection -= new ConnectionOk(OnTcpIPClientConnected); DataOn -= new DataOn(OnTcpIPClientReceived); Disconnection -= new ExceptionDisconnection(OnTcpIPClientDisconnected); TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Intro, "[NetworkClose]:Nothing")); base.Close(); mConnected = false; }
public override void Close() { //if (null != mSendMessageThread) //{ // mSendMessageThread.Abort(); // mSendMessageThread = null; // while (TcpIPMessageQueue.DequeueSend() != null) ; //} TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Intro, "[NetworkClose]:Nothing")); base.Close(); mConnected = false; Connection -= new ConnectionOk(OnTcpIPClientConnected); DataOn -= new DataOn(OnTcpIPClientReceived); Disconnection -= new ExceptionDisconnection(OnTcpIPClientDisconnected); }
void OnTcpIPClientConnected(string message, bool IsConn) { mConnected = IsConn; if (IsConn) { TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Intro, "[OnTcpIPClientConnected1]" + message)); //mSendMessageThread = new Thread(new ParameterizedThreadStart(SendMessageThreading)); //mSendMessageThread.Start(this); } else { TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Intro, "[ff0000][OnTcpIPClientConnected2]" + message)); TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Error, message)); } }
void OnTcpIPClientDisconnected(string message) { //if (null != mSendMessageThread) //{ // mSendMessageThread.Abort(); // mSendMessageThread = null; // while (TcpIPMessageQueue.DequeueSend() != null) ; //} mConnected = false; //if (LocalPlayer.Inst.InLoginState) // TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CPromptMode.Intro信息, "[OnTcpIPClientDisconnected]" + message)); //else TcpIPMessageQueue.EnqueueRecv(S2C_Hint.Builder(S2CHintType.Error, message)); if (null != OnDisConnected) { OnDisConnected(message); } }