コード例 #1
0
        public bool SendByChannel(short msgType, MessageBase msg, int channelId)
        {
#if UNITY_EDITOR
            UnityEditor.NetworkDetailStats.IncrementStat(
                UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
                MsgType.UserMessage, msgType.ToString() + ":" + msg.GetType().Name, 1);
#endif
            if (m_Connection != null)
            {
                if (m_AsyncConnect != ConnectState.Connected)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("NetworkClient SendByChannel when not connected to a server");
                    }
                    return(false);
                }
                return(m_Connection.SendByChannel(msgType, msg, channelId));
            }
            if (LogFilter.logError)
            {
                Debug.LogError("NetworkClient SendByChannel with no connection");
            }
            return(false);
        }
コード例 #2
0
ファイル: NetworkClient.cs プロジェクト: randomize/VimConfig
 public bool SendUnreliable(short msgType, MessageBase msg)
 {
     if (this.m_Connection != null)
     {
         if (this.m_AsyncConnect != ConnectState.Connected)
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("NetworkClient SendUnreliable when not connected to a server");
             }
             return(false);
         }
         NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, 0, msgType.ToString() + ":" + msg.GetType().Name, 1);
         return(this.m_Connection.SendUnreliable(msgType, msg));
     }
     if (LogFilter.logError)
     {
         Debug.LogError("NetworkClient SendUnreliable with no connection");
     }
     return(false);
 }
コード例 #3
0
 public bool SendUnreliable(short msgType, MessageBase msg)
 {
     if (this.m_Connection == null)
     return false;
       NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 0, msgType.ToString() + ":" + msg.GetType().Name, 1);
       return this.m_Connection.SendUnreliable(msgType, msg);
 }
コード例 #4
0
 /// <summary>
 ///   <para>This sends a network message with a message Id to the server on a specific channel.</para>
 /// </summary>
 /// <param name="msgType">The id of the message to send.</param>
 /// <param name="msg">The message to send.</param>
 /// <param name="channelId">The channel to send the message on.</param>
 /// <returns>
 ///   <para>True if the message was sent.</para>
 /// </returns>
 public bool SendByChannel(short msgType, MessageBase msg, int channelId)
 {
     NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short)0, msgType.ToString() + ":" + msg.GetType().Name, 1);
     if (this.m_Connection != null)
     {
         if (this.m_AsyncConnect == NetworkClient.ConnectState.Connected)
         {
             return(this.m_Connection.SendByChannel(msgType, msg, channelId));
         }
         if (LogFilter.logError)
         {
             Debug.LogError((object)"NetworkClient SendByChannel when not connected to a server");
         }
         return(false);
     }
     if (LogFilter.logError)
     {
         Debug.LogError((object)"NetworkClient SendByChannel with no connection");
     }
     return(false);
 }
コード例 #5
0
 public bool SendByChannel(short msgType, MessageBase msg, int channelId)
 {
     NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 0, msgType.ToString() + ":" + msg.GetType().Name, 1);
       if (this.m_Connection != null)
     return this.m_Connection.SendByChannel(msgType, msg, channelId);
       return false;
 }