NetworkEvents.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 Urho3D
  25. {
  26. /// Server connection established.
  27. URHO3D_EVENT(E_SERVERCONNECTED, ServerConnected)
  28. {
  29. }
  30. /// Server connection disconnected.
  31. URHO3D_EVENT(E_SERVERDISCONNECTED, ServerDisconnected)
  32. {
  33. }
  34. /// Server connection failed.
  35. URHO3D_EVENT(E_CONNECTFAILED, ConnectFailed)
  36. {
  37. }
  38. /// New client connection established.
  39. URHO3D_EVENT(E_CLIENTCONNECTED, ClientConnected)
  40. {
  41. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  42. }
  43. /// Client connection disconnected.
  44. URHO3D_EVENT(E_CLIENTDISCONNECTED, ClientDisconnected)
  45. {
  46. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  47. }
  48. /// Client has sent identity: identity map is in the event data.
  49. URHO3D_EVENT(E_CLIENTIDENTITY, ClientIdentity)
  50. {
  51. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  52. URHO3D_PARAM(P_ALLOW, Allow); // bool
  53. }
  54. /// Client has informed to have loaded the scene.
  55. URHO3D_EVENT(E_CLIENTSCENELOADED, ClientSceneLoaded)
  56. {
  57. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  58. }
  59. /// Unhandled network message received.
  60. URHO3D_EVENT(E_NETWORKMESSAGE, NetworkMessage)
  61. {
  62. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  63. URHO3D_PARAM(P_MESSAGEID, MessageID); // int
  64. URHO3D_PARAM(P_DATA, Data); // Buffer
  65. }
  66. /// About to send network update on the client or server.
  67. URHO3D_EVENT(E_NETWORKUPDATE, NetworkUpdate)
  68. {
  69. }
  70. /// Network update has been sent on the client or server.
  71. URHO3D_EVENT(E_NETWORKUPDATESENT, NetworkUpdateSent)
  72. {
  73. }
  74. /// Scene load failed, either due to file not found or checksum error.
  75. URHO3D_EVENT(E_NETWORKSCENELOADFAILED, NetworkSceneLoadFailed)
  76. {
  77. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  78. }
  79. /// Remote event: adds Connection parameter to the event data
  80. URHO3D_EVENT(E_REMOTEEVENTDATA, RemoteEventData)
  81. {
  82. URHO3D_PARAM(P_CONNECTION, Connection); // Connection pointer
  83. }
  84. }