INetworkMessage.cs 930 B

12345678910111213141516171819202122232425
  1. namespace Microsoft.Xna.Framework.Net
  2. {
  3. /// <summary>
  4. /// Represents a network message that can be serialized and deserialized for transmission.
  5. /// </summary>
  6. public interface INetworkMessage
  7. {
  8. /// <summary>
  9. /// Gets the type identifier of the network message.
  10. /// </summary>
  11. byte MessageType { get; }
  12. /// <summary>
  13. /// Serializes the network message into a <see cref="PacketWriter"/> for transmission.
  14. /// </summary>
  15. /// <param name="writer">The <see cref="PacketWriter"/> to serialize the message into.</param>
  16. void Serialize(PacketWriter writer);
  17. /// <summary>
  18. /// Deserializes the network message from a <see cref="PacketReader"/>.
  19. /// </summary>
  20. /// <param name="reader">The <see cref="PacketReader"/> to deserialize the message from.</param>
  21. void Deserialize(PacketReader reader);
  22. }
  23. }