AWSGameLiftClientSystemComponent.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/Component/Component.h>
  10. #include <AzCore/std/smart_ptr/unique_ptr.h>
  11. #include <AWSGameLiftClientLocalTicketTracker.h>
  12. #include <AWSGameLiftClientManager.h>
  13. #include <Request/IAWSGameLiftInternalRequests.h>
  14. namespace AWSGameLift
  15. {
  16. //! Gem client system component. Responsible for creating the gamelift client manager.
  17. class AWSGameLiftClientSystemComponent
  18. : public AZ::Component
  19. , public IAWSGameLiftInternalRequests
  20. {
  21. public:
  22. AZ_COMPONENT(AWSGameLiftClientSystemComponent, "{d481c15c-732a-4eea-9853-4965ed1bc2be}");
  23. AWSGameLiftClientSystemComponent();
  24. virtual ~AWSGameLiftClientSystemComponent() = default;
  25. static void Reflect(AZ::ReflectContext* context);
  26. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  27. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  28. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  29. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  30. // IAWSGameLiftInternalRequests interface implementation
  31. AZStd::shared_ptr<Aws::GameLift::GameLiftClient> GetGameLiftClient() const override;
  32. void SetGameLiftClient(AZStd::shared_ptr<Aws::GameLift::GameLiftClient> gameliftClient) override;
  33. protected:
  34. ////////////////////////////////////////////////////////////////////////
  35. // AZ::Component interface implementation
  36. void Init() override;
  37. void Activate() override;
  38. void Deactivate() override;
  39. ////////////////////////////////////////////////////////////////////////
  40. void SetGameLiftClientManager(AZStd::unique_ptr<AWSGameLiftClientManager> gameliftManager);
  41. void SetGameLiftClientTicketTracker(AZStd::unique_ptr<AWSGameLiftClientLocalTicketTracker> gameliftTicketTracker);
  42. private:
  43. static void ReflectGameLiftMatchmaking(AZ::ReflectContext* context);
  44. static void ReflectGameLiftSession(AZ::ReflectContext* context);
  45. static void ReflectCreateSessionRequest(AZ::ReflectContext* context);
  46. static void ReflectSearchSessionsResponse(AZ::ReflectContext* context);
  47. AZStd::shared_ptr<Aws::GameLift::GameLiftClient> m_gameliftClient;
  48. AZStd::unique_ptr<AWSGameLiftClientManager> m_gameliftManager;
  49. AZStd::unique_ptr<AWSGameLiftClientLocalTicketTracker> m_gameliftTicketTracker;
  50. };
  51. } // namespace AWSGameLift