LyShineMessagePopup.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 <LyShine/Bus/UiCanvasBus.h>
  11. #include <MessagePopup/MessagePopupBus.h>
  12. namespace MessagePopup
  13. {
  14. class LyShineMessagePopup
  15. : public AZ::Component
  16. , protected MessagePopup::MessagePopupImplBus::Handler
  17. , public UiCanvasNotificationBus::MultiHandler
  18. {
  19. public:
  20. AZ_COMPONENT(LyShineMessagePopup, "{C950D60D-4673-4262-A44D-6A0A1A4DB342}");
  21. LyShineMessagePopup();
  22. static void Reflect(AZ::ReflectContext* context);
  23. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  24. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  25. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  26. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  27. protected:
  28. // MessagePopupImplBus interface implementation
  29. virtual void OnShowPopup(AZ::u32 _popupID, const AZStd::string& _message, EPopupButtons _buttons, EPopupKind _kind, AZStd::function<void(int _button)> _callback, void** _popupClientID) override;
  30. virtual void OnHidePopup(const MessagePopupInfo& _popupInfo) override;
  31. //UiCanvasNotificationBus interface implementation
  32. void OnAction(AZ::EntityId entityId, const LyShine::ActionName& actionName) override;
  33. // AZ::Component interface implementation
  34. void Init() override;
  35. void Activate() override;
  36. void Deactivate() override;
  37. AZStd::unordered_map<AZ::EntityId, AZ::u32> m_activePopupIdsByCanvasId;
  38. };
  39. }