LyShineExamplesSystemComponent.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #include <AzCore/Serialization/SerializeContext.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include "LyShineExamplesSystemComponent.h"
  11. #include "LyShineExamplesSerialize.h"
  12. #include "UiDynamicContentDatabase.h"
  13. #include "LyShineExamplesCppExample.h"
  14. namespace LyShineExamples
  15. {
  16. void LyShineExamplesSystemComponent::Reflect(AZ::ReflectContext* context)
  17. {
  18. LyShineExamplesSerialize::ReflectTypes(context);
  19. UiDynamicContentDatabase::Reflect(context);
  20. LyShineExamplesCppExample::Reflect(context);
  21. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  22. {
  23. serialize->Class<LyShineExamplesSystemComponent, AZ::Component>()
  24. ->Version(0)
  25. ;
  26. if (AZ::EditContext* ec = serialize->GetEditContext())
  27. {
  28. ec->Class<LyShineExamplesSystemComponent>("LyShineExamples", "This provides example code using LyShine and code used by sample UI canvases and levels")
  29. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  30. ->Attribute(AZ::Edit::Attributes::Category, "UI")
  31. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  32. ;
  33. }
  34. }
  35. }
  36. void LyShineExamplesSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  37. {
  38. provided.push_back(AZ_CRC_CE("LyShineExamplesService"));
  39. }
  40. void LyShineExamplesSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  41. {
  42. incompatible.push_back(AZ_CRC_CE("LyShineExamplesService"));
  43. }
  44. void LyShineExamplesSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  45. {
  46. required.push_back(AZ_CRC_CE("LyShineService"));;
  47. }
  48. void LyShineExamplesSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  49. {
  50. (void)dependent;
  51. }
  52. UiDynamicContentDatabase* LyShineExamplesSystemComponent::GetUiDynamicContentDatabase()
  53. {
  54. return m_uiDynamicContentDatabase;
  55. }
  56. void LyShineExamplesSystemComponent::Init()
  57. {
  58. }
  59. void LyShineExamplesSystemComponent::Activate()
  60. {
  61. m_uiDynamicContentDatabase = new UiDynamicContentDatabase();
  62. m_cppExample = new LyShineExamplesCppExample();
  63. LyShineExamplesRequestBus::Handler::BusConnect();
  64. LyShineExamplesInternalBus::Handler::BusConnect();
  65. }
  66. void LyShineExamplesSystemComponent::Deactivate()
  67. {
  68. LyShineExamplesRequestBus::Handler::BusDisconnect();
  69. LyShineExamplesInternalBus::Handler::BusDisconnect();
  70. SAFE_DELETE(m_uiDynamicContentDatabase);
  71. SAFE_DELETE(m_cppExample);
  72. }
  73. }