示例#1
0
 private void Server_ClientManager_Client_MessageReceived(object sender, DarkRift.Server.MessageReceivedEventArgs e)
 {
     // Add receive message to list, will read it later by `ServerReceive` function
     using (Message message = e.GetMessage())
     {
         using (DarkRiftReader reader = message.GetReader())
         {
             serverEventQueue.Enqueue(new TransportEventData()
             {
                 type         = ENetworkEvent.DataEvent,
                 connectionId = e.Client.ID,
                 reader       = new NetDataReader(reader.ReadRaw(reader.Length)),
             });
         }
     }
 }
示例#2
0
 private void ServerOnMessageReceived(object sender, ServerMessageReceivedEventArgs e)
 {
     using (Message message = e.GetMessage())
     {
         using (DarkRiftReader reader = message.GetReader())
         {
             for (int i = 0; i < 30; i++)
             {
                 ushort test = reader.ReadUInt16();
                 if (test != 1)
                 {
                     Debug.Log("Received malformatted message!");
                 }
             }
         }
     }
 }