ScriptEventsSystemComponent.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 <AzCore/std/string/string.h>
  11. #include <AzCore/Asset/AssetCommon.h>
  12. #include <AzCore/Debug/Budget.h>
  13. #include <AzCore/std/smart_ptr/unique_ptr.h>
  14. #include <AzCore/std/smart_ptr/intrusive_ptr.h>
  15. #include <ScriptEvents/ScriptEvent.h>
  16. #include <ScriptEvents/ScriptEventsBus.h>
  17. #include <ScriptEvents/ScriptEventsAsset.h>
  18. #include <ScriptEvents/ScriptEventDefinition.h>
  19. #include <ScriptEvents/ScriptEventSystem.h>
  20. AZ_DECLARE_BUDGET(ScriptCanvas);
  21. namespace ScriptEvents
  22. {
  23. class ScriptEventsSystemComponent
  24. : public AZ::Component
  25. {
  26. public:
  27. AZ_COMPONENT(ScriptEventsSystemComponent, "{43068F27-B171-4DF4-B583-57CEF3F2AC6C}");
  28. static void Reflect(AZ::ReflectContext* context);
  29. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  30. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  31. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  32. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  33. protected:
  34. ////////////////////////////////////////////////////////////////////////
  35. // AZ::Component...
  36. void Init() override;
  37. void Activate() override;
  38. void Deactivate() override;
  39. ////////////////////////////////////////////////////////////////////////
  40. // Script Event Assets
  41. AZStd::unordered_map<ScriptEventKey, AZStd::intrusive_ptr<ScriptEvents::Internal::ScriptEventRegistration>> m_scriptEvents;
  42. };
  43. class ScriptEventsSystemComponentRuntimeImpl
  44. : public ScriptEventsSystemComponentImpl
  45. {
  46. public:
  47. AZ_CLASS_ALLOCATOR(ScriptEventsSystemComponentRuntimeImpl, AZ::SystemAllocator)
  48. void RegisterAssetHandler() override;
  49. void UnregisterAssetHandler() override;
  50. AZStd::unique_ptr<ScriptEventAssetRuntimeHandler> m_assetHandler;
  51. };
  52. }