MultiplayerEditorAutomation.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/ComponentBus.h>
  10. #include <AzCore/Memory/Memory.h>
  11. #include <AzCore/RTTI/BehaviorContext.h>
  12. #include <AzCore/RTTI/RTTI.h>
  13. #include <Multiplayer/MultiplayerEditorServerBus.h>
  14. namespace Multiplayer::Automation
  15. {
  16. //! Multiplayer Editor event handler for python automation
  17. //! This class will pick up Multiplayer Editor notifications and make sure they are forwarded and available for python automation tests
  18. class MultiplayerEditorAutomationHandler
  19. : public MultiplayerEditorServerNotificationBus::Handler
  20. , public AZ::BehaviorEBusHandler
  21. {
  22. public:
  23. AZ_EBUS_BEHAVIOR_BINDER(
  24. MultiplayerEditorAutomationHandler, "{CBA9A03D-ED7C-472E-B79F-1CCAB22D048C}", AZ::SystemAllocator,
  25. OnServerLaunched,
  26. OnServerLaunchFail,
  27. OnEditorConnectionAttempt,
  28. OnEditorConnectionAttemptsFailed,
  29. OnEditorSendingLevelData,
  30. OnEditorSendingLevelDataFailed,
  31. OnEditorSendingLevelDataSuccess,
  32. OnConnectToSimulationSuccess,
  33. OnConnectToSimulationFail,
  34. OnPlayModeEnd,
  35. OnEditorServerProcessStoppedUnexpectedly);
  36. static void Reflect(AZ::ReflectContext* context);
  37. private:
  38. //! MultiplayerEditorServerNotificationBus::Handler
  39. //! @{
  40. void OnServerLaunched() override;
  41. void OnServerLaunchFail() override;
  42. void OnEditorConnectionAttempt(uint16_t connectionAttempts, uint16_t maxAttempts) override;
  43. void OnEditorConnectionAttemptsFailed(uint16_t failedAttempts) override;
  44. void OnEditorSendingLevelData(uint32_t bytesSent, uint32_t bytesTotal) override;
  45. void OnEditorSendingLevelDataFailed() override;
  46. void OnEditorSendingLevelDataSuccess() override;
  47. void OnConnectToSimulationSuccess() override;
  48. void OnConnectToSimulationFail(uint16_t serverPort) override;
  49. void OnPlayModeEnd() override;
  50. void OnEditorServerProcessStoppedUnexpectedly() override;
  51. //! @}
  52. };
  53. } // namespace Multiplayer::Automation