UiCanvasDemoPlacardComponent.h 1.8 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 <AzCore/Component/Component.h>
  10. #include <LyShine/Bus/World/UiCanvasRefBus.h>
  11. namespace MultiplayerSample
  12. {
  13. class UiCanvasDemoPlacardComponent
  14. : public AZ::Component
  15. , UiCanvasAssetRefNotificationBus::Handler
  16. {
  17. public:
  18. AZ_COMPONENT(MultiplayerSample::UiCanvasDemoPlacardComponent, "{8ED1F410-04CA-4180-BF2F-D24A1BB4BF7D}");
  19. /*
  20. * Reflects component data into the reflection contexts, including the serialization, edit, and behavior contexts.
  21. */
  22. static void Reflect(AZ::ReflectContext* context);
  23. /*
  24. * Specifies the services that this component requires.
  25. * The system activates the required services before it activates this component.
  26. * It also deactivates the required services after it deactivates this component.
  27. * If a required service is missing before this component is activated, the system
  28. * returns an error and does not activate this component.
  29. */
  30. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  31. protected:
  32. void Activate() override;
  33. void Deactivate() override;
  34. private:
  35. // UiCanvasAssetRefNotificationBus overrides ...
  36. void OnCanvasLoadedIntoEntity(AZ::EntityId uiCanvasEntity) override;
  37. void SetUiCanvasText(AZ::EntityId uiCanvasEntityId);
  38. private:
  39. int m_placardTextboxUiElementId = 0;
  40. AZStd::string m_placardText = "Default Placard Text";
  41. };
  42. } // namespace MultiplayerSample