AWSGameLiftLeaveSessionActivity.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #include <Activity/AWSGameLiftLeaveSessionActivity.h>
  13. #include <AzCore/Interface/Interface.h>
  14. #include <AzFramework/Session/ISessionHandlingRequests.h>
  15. namespace AWSGameLift
  16. {
  17. namespace LeaveSessionActivity
  18. {
  19. void LeaveSession()
  20. {
  21. auto clientRequestHandler = AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get();
  22. if (clientRequestHandler)
  23. {
  24. AZ_TracePrintf(AWSGameLiftLeaveSessionActivityName, "Requesting to leave the current session...");
  25. clientRequestHandler->RequestPlayerLeaveSession();
  26. }
  27. else
  28. {
  29. AZ_Error(AWSGameLiftLeaveSessionActivityName, false, AWSGameLiftLeaveSessionMissingRequestHandlerErrorMessage);
  30. }
  31. }
  32. } // namespace LeaveSessionActivity
  33. } // namespace AWSGameLift