AWSGameLiftMatchmakingRequestBus.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include <Multiplayer/Session/IMatchmakingRequests.h>
  12. namespace AWSGameLift
  13. {
  14. // IMatchmakingAsyncRequests EBus wrapper
  15. class AWSGameLiftMatchmakingAsyncRequests
  16. : public AZ::EBusTraits
  17. {
  18. public:
  19. using MutexType = AZStd::recursive_mutex;
  20. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  21. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  22. };
  23. using AWSGameLiftMatchmakingAsyncRequestBus = AZ::EBus<Multiplayer::IMatchmakingAsyncRequests, AWSGameLiftMatchmakingAsyncRequests>;
  24. // IMatchmakingRequests EBus wrapper
  25. class AWSGameLiftMatchmakingRequests
  26. : public AZ::EBusTraits
  27. {
  28. public:
  29. using MutexType = AZStd::recursive_mutex;
  30. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  31. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  32. };
  33. using AWSGameLiftMatchmakingRequestBus = AZ::EBus<Multiplayer::IMatchmakingRequests, AWSGameLiftMatchmakingRequests>;
  34. //! IAWSGameLiftMatchmakingEventRequests
  35. //! GameLift Gem matchmaking event interfaces which is used to track matchmaking ticket event
  36. //! Developer should define the way to poll matchmaking ticket event and behavior based on the ticket status
  37. //! Use AWSGameLiftClientLocalTicketTracker as an example, it uses continuous polling to query matchmaking ticket:
  38. //! StartPolling - local ticket tracker starts monitor process for matchmaking ticket, and joins player
  39. //! to the match once ticket is complete
  40. //! StopPolling - local ticket tracker cancels ongoing matchmaking ticket and stops monitoring process
  41. class IAWSGameLiftMatchmakingEventRequests
  42. {
  43. public:
  44. AZ_RTTI(IAWSGameLiftMatchmakingEventRequests, "{C2DA440E-74E0-411E-813D-5880B50B0C9E}");
  45. IAWSGameLiftMatchmakingEventRequests() = default;
  46. virtual ~IAWSGameLiftMatchmakingEventRequests() = default;
  47. //! StartPolling
  48. //! Request to start process for polling matchmaking ticket based on given ticket id and player Id
  49. //! @param ticketId The requested matchmaking ticket id
  50. //! @param playerId The requested matchmaking player id
  51. virtual void StartPolling(const AZStd::string& ticketId, const AZStd::string& playerId) = 0;
  52. //! StopPolling
  53. //! Request to stop process for polling matchmaking ticket
  54. virtual void StopPolling() = 0;
  55. };
  56. // IAWSGameLiftMatchmakingEventRequests EBus wrapper
  57. class AWSGameLiftMatchmakingEventRequests
  58. : public AZ::EBusTraits
  59. {
  60. public:
  61. using MutexType = AZStd::recursive_mutex;
  62. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  63. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  64. };
  65. using AWSGameLiftMatchmakingEventRequestBus = AZ::EBus<IAWSGameLiftMatchmakingEventRequests, AWSGameLiftMatchmakingEventRequests>;
  66. } // namespace AWSGameLift