MessagePopupManager.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <MessagePopup/MessagePopupBus.h>
  11. #include <AzCore/std/containers/map.h>
  12. #include <AzCore/Component/TickBus.h>
  13. namespace MessagePopup
  14. {
  15. //////////////////////////////////////////////////////////////////////////
  16. class MessagePopupManager :
  17. public AZ::TickBus::Handler
  18. {
  19. public:
  20. MessagePopupManager();
  21. bool SetPopupData(AZ::u32 _popupID, void *_clientID, AZStd::function<void(int _button)> _callback, float _showTime);
  22. AZ::u32 CreatePopup();
  23. bool RemovePopup(AZ::u32 _popupID);
  24. void* GetPopupClientData(AZ::u32 _popupID);
  25. MessagePopupInfo* GetPopupInfo(AZ::u32 _popupID);
  26. AZ::u32 GetNumActivePopups() const { return static_cast<AZ::u32>(m_currentPopups.size()); }
  27. protected:
  28. //////////////////////////////////////////////////////////////////////////
  29. // TickBus
  30. virtual void OnTick(float deltaTime, AZ::ScriptTimePoint scriptTimePoint) override;
  31. private:
  32. typedef AZStd::map<AZ::u32, MessagePopupInfo*> CurrentPopupsMap;
  33. CurrentPopupsMap m_currentPopups;
  34. };
  35. }