NetworkEvents.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // Copyright (c) 2008-2017 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../Core/Object.h"
  24. namespace Atomic
  25. {
  26. /// Server connection established.
  27. ATOMIC_EVENT(E_SERVERCONNECTED, ServerConnected)
  28. {
  29. }
  30. /// Server connection disconnected.
  31. ATOMIC_EVENT(E_SERVERDISCONNECTED, ServerDisconnected)
  32. {
  33. }
  34. /// Server connection failed.
  35. ATOMIC_EVENT(E_CONNECTFAILED, ConnectFailed)
  36. {
  37. }
  38. /// New client connection established.
  39. ATOMIC_EVENT(E_CLIENTCONNECTED, ClientConnected)
  40. {
  41. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  42. }
  43. /// Client connection disconnected.
  44. ATOMIC_EVENT(E_CLIENTDISCONNECTED, ClientDisconnected)
  45. {
  46. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  47. }
  48. /// Client has sent identity: identity map is in the event data.
  49. ATOMIC_EVENT(E_CLIENTIDENTITY, ClientIdentity)
  50. {
  51. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  52. ATOMIC_PARAM(P_ALLOW, Allow); // bool
  53. }
  54. /// Client has informed to have loaded the scene.
  55. ATOMIC_EVENT(E_CLIENTSCENELOADED, ClientSceneLoaded)
  56. {
  57. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  58. }
  59. /// Unhandled network message received.
  60. ATOMIC_EVENT(E_NETWORKMESSAGE, NetworkMessage)
  61. {
  62. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  63. ATOMIC_PARAM(P_MESSAGEID, MessageID); // int
  64. ATOMIC_PARAM(P_DATA, Data); // Buffer
  65. }
  66. /// About to send network update on the client or server.
  67. ATOMIC_EVENT(E_NETWORKUPDATE, NetworkUpdate)
  68. {
  69. }
  70. /// Network update has been sent on the client or server.
  71. ATOMIC_EVENT(E_NETWORKUPDATESENT, NetworkUpdateSent)
  72. {
  73. }
  74. /// Scene load failed, either due to file not found or checksum error.
  75. ATOMIC_EVENT(E_NETWORKSCENELOADFAILED, NetworkSceneLoadFailed)
  76. {
  77. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  78. }
  79. /// Remote event: adds Connection parameter to the event data
  80. ATOMIC_EVENT(E_REMOTEEVENTDATA, RemoteEventData)
  81. {
  82. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  83. }
  84. // ATOMIC BEGIN
  85. /// Master server connection ready
  86. ATOMIC_EVENT(E_MASTERCONNECTIONREADY, MasterConnectionReady)
  87. {
  88. }
  89. /// Master server connection failed
  90. ATOMIC_EVENT(E_MASTERCONNECTIONFAILED, MasterConnectionFailed)
  91. {
  92. }
  93. /// Unhandled master message received.
  94. ATOMIC_EVENT(E_MASTERMESSAGE, MasterServerMessage)
  95. {
  96. ATOMIC_PARAM(P_DATA, Data); // Buffer
  97. }
  98. /// Unhandled master message received.
  99. ATOMIC_EVENT(E_NETWORKSTRINGMESSAGE, NetworkStringMessage)
  100. {
  101. ATOMIC_PARAM(P_CONNECTION, Connection); // Connection pointer
  102. ATOMIC_PARAM(P_DATA, Data); // Buffer
  103. }
  104. // ATOMIC END
  105. }