Пример #1
0
 public void ServerSend(EEvet evt, params object[] args)
 {
     if (NetworkServer.active)
     {
         MessageToByte t = new MessageToByte();
         MainClass     m = new MainClass();
         m.message = evt;
         m.aa      = args;
         t.buff    = t.Object2Bytes(m);
         if (NetworkServer.SendToAll(userMsg, t))
         {
             ShowMsg("Server send:" + m.message);
         }
     }
 }
Пример #2
0
    /// <summary>
    /// 客户端向服务器端发送信息
    /// </summary>
    public void ClientSend(EEvet evt, params object[] args)
    {
        if (myClient.isConnected)
        {
            MessageToByte clientT = new MessageToByte();
            MainClass     clientM = new MainClass();
            clientM.message = evt;
            clientM.aa      = args;

            clientT.buff = clientT.Object2Bytes(clientM);
            if (myClient.Send(userMsg, clientT))
            {
                ShowMsg("Server send:" + clientT.buff);
            }
        }
    }
Пример #3
0
    /// <summary>
    /// 服务器端向所有客户端发送信息
    /// </summary>
    public void ServerSend()
    {
        if (NetworkServer.active)
        {
            //UserMsg um = new UserMsg();
            //um.message = send.text;

            MessageToByte t = new MessageToByte();

            MainClass m = new MainClass();
            m.aa = new object[] { 1, 4, "shjhi", 3.5f };

            t.buff = t.Object2Bytes(m);
            if (NetworkServer.SendToAll(userMsg, t))
            {
                ShowMsg("Server send:" + t.buff);
            }
        }
    }