예제 #1
0
        public static IS2C_Msg Builder(S2CHintType mode, string hints)
        {
            var msg = new S2C_Hint();

            msg.mode = mode;
            msg.msg  = hints;
            return(msg);
        }
예제 #2
0
 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;
 }
예제 #3
0
        public static IS2C_Msg Builder(Stream buffer)
        {
            var  msg  = new S2C_Hint();
            Byte mode = 0;

            StreamUtils.Read(buffer, ref mode);
            msg.mode = (S2CHintType)mode;
            StreamUtils.Read(buffer, ref msg.msg);
            //if(msg.mode == S2CPromptMode.滚动公告)
            //    UnityEngine.Debug.LogWarning("[滚动公告]" + msg.msg);
            return(msg);
        }
예제 #4
0
 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);
 }
예제 #5
0
 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));
     }
 }
예제 #6
0
 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);
     }
 }