Message.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. namespace Mirror.SimpleWeb
  3. {
  4. public struct Message
  5. {
  6. public readonly int connId;
  7. public readonly EventType type;
  8. public readonly ArrayBuffer data;
  9. public readonly Exception exception;
  10. public Message(EventType type) : this()
  11. {
  12. this.type = type;
  13. }
  14. public Message(ArrayBuffer data) : this()
  15. {
  16. type = EventType.Data;
  17. this.data = data;
  18. }
  19. public Message(Exception exception) : this()
  20. {
  21. type = EventType.Error;
  22. this.exception = exception;
  23. }
  24. public Message(int connId, EventType type) : this()
  25. {
  26. this.connId = connId;
  27. this.type = type;
  28. }
  29. public Message(int connId, ArrayBuffer data) : this()
  30. {
  31. this.connId = connId;
  32. type = EventType.Data;
  33. this.data = data;
  34. }
  35. public Message(int connId, Exception exception) : this()
  36. {
  37. this.connId = connId;
  38. type = EventType.Error;
  39. this.exception = exception;
  40. }
  41. }
  42. }