private void OnConnected(object sender, GameEventArgs e)
    {
        NetworkConnectedEventArgs ne = (NetworkConnectedEventArgs)e;

        // 发送消息给服务端
        m_Channel.Send(new CSHello()
        {
            Name = "服务器你好吗?",
        });
    }
示例#2
0
 public void SendMsg(CSPacketBase msg)
 {
     if (IsConnectedToServer && m_NetworkChannel.Connected)
     {
         m_NetworkChannel.Send(msg);
     }
     else
     {
         Debug.LogError("m_NetworkChannel.Connected:" + m_NetworkChannel.Connected);
         GameEntry.UI.AddTips("服务器未连接");
         ConnectServer();
     }
 }
示例#3
0
 public static void send(PacketBase packet)
 {
     m_Channel.Send(packet);
 }