You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Templates/PythonToolGem/Template/Code/Source/${Name}EditorSystemComponen...

71 lines
2.3 KiB
C++

// {BEGIN_LICENSE}
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
// {END_LICENSE}
#include <AzCore/Serialization/SerializeContext.h>
#include <${Name}EditorSystemComponent.h>
namespace ${SanitizedCppName}
{
void ${SanitizedCppName}EditorSystemComponent::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<${SanitizedCppName}EditorSystemComponent, AZ::Component>();
}
}
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent()
{
if (${SanitizedCppName}Interface::Get() == nullptr)
{
${SanitizedCppName}Interface::Register(this);
}
}
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent()
{
if (${SanitizedCppName}Interface::Get() == this)
{
${SanitizedCppName}Interface::Unregister(this);
}
}
void ${SanitizedCppName}EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
}
void ${SanitizedCppName}EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
}
void ${SanitizedCppName}EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
}
void ${SanitizedCppName}EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
}
void ${SanitizedCppName}EditorSystemComponent::Activate()
{
${SanitizedCppName}RequestBus::Handler::BusConnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
void ${SanitizedCppName}EditorSystemComponent::Deactivate()
{
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
${SanitizedCppName}RequestBus::Handler::BusDisconnect();
}
} // namespace ${SanitizedCppName}