SessionConfig.cpp 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/Serialization/EditContext.h>
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. #include <Multiplayer/Session/SessionConfig.h>
  11. namespace Multiplayer
  12. {
  13. void SessionConfig::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serializeContext->Class<SessionConfig>()
  18. ->Version(0)
  19. ->Field("creationTime", &SessionConfig::m_creationTime)
  20. ->Field("terminationTime", &SessionConfig::m_terminationTime)
  21. ->Field("creatorId", &SessionConfig::m_creatorId)
  22. ->Field("sessionProperties", &SessionConfig::m_sessionProperties)
  23. ->Field("matchmakingData", &SessionConfig::m_matchmakingData)
  24. ->Field("sessionId", &SessionConfig::m_sessionId)
  25. ->Field("sessionName", &SessionConfig::m_sessionName)
  26. ->Field("dnsName", &SessionConfig::m_dnsName)
  27. ->Field("ipAddress", &SessionConfig::m_ipAddress)
  28. ->Field("port", &SessionConfig::m_port)
  29. ->Field("maxPlayer", &SessionConfig::m_maxPlayer)
  30. ->Field("currentPlayer", &SessionConfig::m_currentPlayer)
  31. ->Field("status", &SessionConfig::m_status)
  32. ->Field("statusReason", &SessionConfig::m_statusReason)
  33. ;
  34. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  35. {
  36. editContext->Class<SessionConfig>("SessionConfig", "Properties describing a session")
  37. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  38. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  39. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_creationTime,
  40. "CreationTime", "A time stamp indicating when this session was created. Format is a number expressed in Unix time as milliseconds.")
  41. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_terminationTime,
  42. "TerminationTime", "A time stamp indicating when this data object was terminated. Same format as creation time.")
  43. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_creatorId,
  44. "CreatorId", "A unique identifier for a player or entity creating the session.")
  45. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_sessionProperties,
  46. "SessionProperties", "A collection of custom properties for a session.")
  47. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_matchmakingData,
  48. "MatchmakingData", "The matchmaking process information that was used to create the session.")
  49. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_sessionId,
  50. "SessionId", "A unique identifier for the session.")
  51. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_sessionName,
  52. "SessionName", "A descriptive label that is associated with a session.")
  53. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_dnsName,
  54. "DnsName", "The DNS identifier assigned to the instance that is running the session.")
  55. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_ipAddress,
  56. "IpAddress", "The IP address of the session.")
  57. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_port,
  58. "Port", "The port number for the session.")
  59. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_maxPlayer,
  60. "MaxPlayer", "The maximum number of players that can be connected simultaneously to the session.")
  61. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_currentPlayer,
  62. "CurrentPlayer", "Number of players currently in the session.")
  63. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_status,
  64. "Status", "Current status of the session.")
  65. ->DataElement(AZ::Edit::UIHandlers::Default, &Multiplayer::SessionConfig::m_statusReason,
  66. "StatusReason", "Provides additional information about session status.");
  67. }
  68. }
  69. }
  70. } // namespace Multiplayer