AWSGameLiftRequestBus.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #pragma once
  9. #include <AzCore/EBus/EBus.h>
  10. #include <AzCore/std/string/string.h>
  11. namespace AWSGameLift
  12. {
  13. //! IAWSGameLiftRequests
  14. //! GameLift Gem interfaces to configure GameLift client and other help functions,
  15. //! like creating random GameLift player id
  16. class IAWSGameLiftRequests
  17. {
  18. public:
  19. AZ_RTTI(IAWSGameLiftRequests, "{494167AD-1185-4AF3-8BF9-C8C37FC9C199}");
  20. IAWSGameLiftRequests() = default;
  21. virtual ~IAWSGameLiftRequests() = default;
  22. //! ConfigureGameLiftClient
  23. //! Configure GameLift client to interact with Amazon GameLift service
  24. //! @param region Specifies the AWS region to use
  25. //! @return True if client configuration succeeds, false otherwise
  26. virtual bool ConfigureGameLiftClient(const AZStd::string& region) = 0;
  27. //! CreatePlayerId
  28. //! Create a new, random ID number for every player in every new game session.
  29. //! @param includeBrackets Whether includes brackets in player id
  30. //! @param includeDashes Whether includes dashes in player id
  31. //! @return The player id to use in game session
  32. virtual AZStd::string CreatePlayerId(bool includeBrackets, bool includeDashes) = 0;
  33. };
  34. // IAWSGameLiftRequests EBus wrapper
  35. class AWSGameLiftRequests
  36. : public AZ::EBusTraits
  37. {
  38. public:
  39. using MutexType = AZStd::recursive_mutex;
  40. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  41. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  42. };
  43. using AWSGameLiftRequestBus = AZ::EBus<IAWSGameLiftRequests, AWSGameLiftRequests>;
  44. } // namespace AWSGameLift