public void SendSocketMessage(ESocketEventType eventType, string data)
        {
            SocketMessageStruct mes = new SocketMessageStruct();

            mes.eventType = (int)eventType;
            mes.data      = data;
            try
            {
                string json = JsonUtility.ToJson(mes);
#if UNITY_EDITOR || UNITY_STANDALONE
                if (mWebSocketConnectionList != null)
                {
                    for (int i = 0; i < mWebSocketConnectionList.Count; i++)
                    {
                        if (mWebSocketConnectionList[i] != null && mWebSocketConnectionList[i].IsAvailable)
                        {
                            mWebSocketConnectionList[i].Send(json);
                        }
                    }
                }
#elif UNITY_ANDROID || UNITY_IPHONE
                if (mClientSocket != null)
                {
                    mClientSocket.Send(json);
                }
#endif
            }
            catch (Exception e)
            {
                Debug.Log("发送消息解析出错     error:" + e.Message);
            }
        }
 public void UnRegistEventHandler(ESocketEventType eventType, SocketEventHandler callback)
 {
     if (mSocketEventDic != null && mSocketEventDic.ContainsKey((int)eventType))
     {
         mSocketEventDic[(int)eventType] -= callback;
         if (mSocketEventDic[(int)eventType] == null)
         {
             mSocketEventDic.Remove((int)eventType);
         }
     }
 }
 public void RegistSocketEventHandler(ESocketEventType eventType, SocketEventHandler callback)
 {
     if (mSocketEventDic != null)
     {
         if (mSocketEventDic.ContainsKey((int)eventType))
         {
             mSocketEventDic[(int)eventType] += callback;
         }
         else
         {
             mSocketEventDic.Add((int)eventType, callback);
         }
     }
 }