AWSGameLiftPlayer.cpp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <AWSGameLiftPlayer.h>
  11. namespace AWSGameLift
  12. {
  13. void AWSGameLiftPlayer::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serializeContext->Class<AWSGameLiftPlayer>()
  18. ->Version(0)
  19. ->Field("latencyInMs", &AWSGameLiftPlayer::m_latencyInMs)
  20. ->Field("playerAttributes", &AWSGameLiftPlayer::m_playerAttributes)
  21. ->Field("playerId", &AWSGameLiftPlayer::m_playerId)
  22. ->Field("team", &AWSGameLiftPlayer::m_team);
  23. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  24. {
  25. editContext->Class<AWSGameLiftPlayer>("AWSGameLiftPlayer", "")
  26. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  27. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  28. ->DataElement(
  29. AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayer::m_latencyInMs, "LatencyInMs",
  30. "A set of values, expressed in milliseconds, that indicates the amount of latency that"
  31. "a player experiences when connected to AWS Regions")
  32. ->DataElement(
  33. AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayer::m_playerAttributes, "PlayerAttributes",
  34. "A collection of key:value pairs containing player information for use in matchmaking")
  35. ->DataElement(
  36. AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayer::m_playerId, "PlayerId",
  37. "A unique identifier for a player")
  38. ->DataElement(
  39. AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayer::m_team, "Team",
  40. "Name of the team that the player is assigned to in a match");
  41. }
  42. }
  43. if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  44. {
  45. behaviorContext->Class<AWSGameLiftPlayer>("AWSGameLiftPlayer")
  46. ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
  47. ->Property("LatencyInMs", BehaviorValueProperty(&AWSGameLiftPlayer::m_latencyInMs))
  48. ->Property("PlayerAttributes", BehaviorValueProperty(&AWSGameLiftPlayer::m_playerAttributes))
  49. ->Property("PlayerId", BehaviorValueProperty(&AWSGameLiftPlayer::m_playerId))
  50. ->Property("Team", BehaviorValueProperty(&AWSGameLiftPlayer::m_team));
  51. }
  52. }
  53. } // namespace AWSGameLift