MatchmakingRequests.cpp 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/RTTI/ReflectContext.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <Multiplayer/Session/MatchmakingRequests.h>
  12. namespace Multiplayer
  13. {
  14. void AcceptMatchRequest::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serializeContext->Class<AcceptMatchRequest>()
  19. ->Version(0)
  20. ->Field("acceptMatch", &AcceptMatchRequest::m_acceptMatch)
  21. ->Field("playerIds", &AcceptMatchRequest::m_playerIds)
  22. ->Field("ticketId", &AcceptMatchRequest::m_ticketId);
  23. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  24. {
  25. editContext->Class<AcceptMatchRequest>("AcceptMatchRequest", "The container for AcceptMatch request parameters")
  26. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  27. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  28. ->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_acceptMatch, "AcceptMatch",
  29. "Player response to accept or reject match")
  30. ->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_playerIds, "PlayerIds",
  31. "A list of unique identifiers for players delivering the response")
  32. ->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_ticketId, "TicketId",
  33. "A unique identifier for a matchmaking ticket");
  34. }
  35. }
  36. }
  37. void StartMatchmakingRequest::Reflect(AZ::ReflectContext* context)
  38. {
  39. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  40. {
  41. serializeContext->Class<StartMatchmakingRequest>()
  42. ->Version(0)
  43. ->Field("ticketId", &StartMatchmakingRequest::m_ticketId);
  44. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  45. {
  46. editContext->Class<StartMatchmakingRequest>("StartMatchmakingRequest", "The container for StartMatchmaking request parameters")
  47. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  48. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  49. ->DataElement(AZ::Edit::UIHandlers::Default, &StartMatchmakingRequest::m_ticketId, "TicketId",
  50. "A unique identifier for a matchmaking ticket");
  51. }
  52. }
  53. }
  54. void StopMatchmakingRequest::Reflect(AZ::ReflectContext* context)
  55. {
  56. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  57. {
  58. serializeContext->Class<StopMatchmakingRequest>()
  59. ->Version(0)
  60. ->Field("ticketId", &StopMatchmakingRequest::m_ticketId);
  61. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  62. {
  63. editContext->Class<StopMatchmakingRequest>("StopMatchmakingRequest", "The container for StopMatchmaking request parameters")
  64. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  65. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  66. ->DataElement(AZ::Edit::UIHandlers::Default, &StopMatchmakingRequest::m_ticketId, "TicketId",
  67. "A unique identifier for a matchmaking ticket");
  68. }
  69. }
  70. }
  71. } // namespace Multiplayer