LyShineLoadScreen.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <LoadScreenBus.h>
  10. #if AZ_LOADSCREENCOMPONENT_ENABLED
  11. #include <AzCore/Component/Component.h>
  12. namespace LyShine
  13. {
  14. class LyShineLoadScreenComponent
  15. : public AZ::Component
  16. , public LoadScreenNotificationBus::Handler
  17. , public LoadScreenUpdateNotificationBus::Handler
  18. {
  19. public:
  20. AZ_COMPONENT(LyShineLoadScreenComponent, "{AE8DA868-1069-48FF-8ED7-AC28829366BB}");
  21. static void Reflect(AZ::ReflectContext* context);
  22. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  23. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  24. public:
  25. LyShineLoadScreenComponent() = default;
  26. ~LyShineLoadScreenComponent() = default;
  27. // AZ::Component
  28. void Init() override;
  29. void Activate() override;
  30. void Deactivate() override;
  31. // ~AZ::Component
  32. // LoadScreenNotificationBus::Handler
  33. bool NotifyGameLoadStart(bool usingLoadingThread) override;
  34. bool NotifyLevelLoadStart(bool usingLoadingThread) override;
  35. void NotifyLoadEnd() override;
  36. // ~LoadScreenNotificationBus::Handler
  37. // LoadScreenUpdateNotificationBus::Handler
  38. void UpdateAndRender(float deltaTimeInSeconds) override;
  39. void LoadThreadUpdate(float deltaTimeInSeconds) override;
  40. void LoadThreadRender() override;
  41. // ~LoadScreenUpdateNotificationBus::Handler
  42. protected:
  43. void Reset();
  44. AZ::EntityId loadFromCfg(const char* pathVarName, const char* autoPlayVarName);
  45. bool m_isPlaying{ false };
  46. AZ::EntityId m_gameCanvasEntityId{};
  47. AZ::EntityId m_levelCanvasEntityId{};
  48. };
  49. } // namespace LyShine
  50. #endif // AZ_LOADSCREENCOMPONENT_ENABLED