Ejemplo n.º 1
0
 private void UdpOnError(SocketState state, Exception e = null)
 {
     Debug.logger.LogError("ServerError", "在" + state.ToString() + "下报错");
     Debug.LogException(e);
     EventDispatcher.TriggerEvent <SocketState, Exception>(ServerEvent.UdpOnError, state, e);
     //Todo
     Disconnect();
 }
Ejemplo n.º 2
0
 private void TcpOnError(SocketState state, Exception e = null)
 {
     MonoActionPool.AddAction(() =>
     {
         Debug.unityLogger.LogError("ServerError", "在" + state.ToString() + "下报错");
         Debug.LogException(e);
         EventDispatcher.TriggerEvent <SocketState, Exception>(ServerEvent.TcpOnError, state, e);
         //Todo
         Disconnect();
     });
 }
 public void SetSocketState(SocketState ss)
 {
     if (this.socket_status_label.InvokeRequired)
     {
         this.socket_status_label.BeginInvoke((MethodInvoker) delegate() { this.socket_status_label.Text = ss.ToString(); });
     }
     else
     {
         this.socket_status_label.Text = ss.ToString();
     }
 }
Ejemplo n.º 4
0
    public void ChangeState(SocketState state)
    {
        if (m_CurrentState == state)
        {
            return;
        }

        if (m_SocketStateDic.ContainsKey(state))
        {
            if (m_CurrentState != SocketState.Idle)
            {
                m_SocketStateDic[m_CurrentState].OnExit();
            }
            Debug.Log("网络状态切换到" + state.ToString());
            m_CurrentState = state;

            m_SocketStateDic[m_CurrentState].OnEnter();
        }
    }