${Name}EditorSystemComponent.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // {BEGIN_LICENSE}
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. // {END_LICENSE}
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include "${Name}EditorSystemComponent.h"
  12. #include <${Name}/${Name}TypeIds.h>
  13. namespace ${SanitizedCppName}
  14. {
  15. AZ_COMPONENT_IMPL(${SanitizedCppName}EditorSystemComponent, "${SanitizedCppName}EditorSystemComponent",
  16. ${SanitizedCppName}EditorSystemComponentTypeId);
  17. void ${SanitizedCppName}EditorSystemComponent::Reflect(AZ::ReflectContext* context)
  18. {
  19. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serializeContext->Class<${SanitizedCppName}EditorSystemComponent, AZ::Component>();
  22. }
  23. }
  24. ${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent()
  25. {
  26. if (${SanitizedCppName}Interface::Get() == nullptr)
  27. {
  28. ${SanitizedCppName}Interface::Register(this);
  29. }
  30. }
  31. ${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent()
  32. {
  33. if (${SanitizedCppName}Interface::Get() == this)
  34. {
  35. ${SanitizedCppName}Interface::Unregister(this);
  36. }
  37. }
  38. void ${SanitizedCppName}EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  39. {
  40. provided.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
  41. }
  42. void ${SanitizedCppName}EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  43. {
  44. incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
  45. }
  46. void ${SanitizedCppName}EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  47. {
  48. }
  49. void ${SanitizedCppName}EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  50. {
  51. }
  52. void ${SanitizedCppName}EditorSystemComponent::Activate()
  53. {
  54. ${SanitizedCppName}RequestBus::Handler::BusConnect();
  55. }
  56. void ${SanitizedCppName}EditorSystemComponent::Deactivate()
  57. {
  58. ${SanitizedCppName}RequestBus::Handler::BusDisconnect();
  59. }
  60. } // namespace ${SanitizedCppName}