UiElementLuaBus.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <LyShine/Bus/UiElementBus.h>
  10. #include <AzCore/Component/Component.h>
  11. //! \brief Mirrors the UiElementBus for use in Lua.
  12. class UiElementLuaInterface
  13. : public AZ::ComponentBus
  14. {
  15. public: // member functions
  16. virtual ~UiElementLuaInterface() {}
  17. virtual bool IsEnabled() = 0;
  18. virtual void SetIsEnabled(bool isEnabled) = 0;
  19. };
  20. typedef AZ::EBus<UiElementLuaInterface> UiElementLuaBus;
  21. //! \brief This component serves as the bridge between UiElementBus and UiElementLuaBus
  22. class UiElementLuaProxy
  23. : public UiElementLuaBus::Handler
  24. {
  25. public: // member functions
  26. // UiElementLuaInterface
  27. bool IsEnabled() override;
  28. void SetIsEnabled(bool isEnabled) override;
  29. // ~UiElementLuaInterface
  30. //! \brief Adds this object as a handler for UiElementLuaBus
  31. void BusConnect(AZ::EntityId entityId);
  32. public: // static member functions
  33. static void Reflect(AZ::ReflectContext* context);
  34. private: // data
  35. AZ::EntityId m_targetEntity;
  36. };