SHARE
TWEET

Untitled

a guest Dec 29th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "TestProject1_precompiled.h"
  2. #include <AzCore/Memory/SystemAllocator.h>
  3. #include <AzCore/Module/Module.h>
  4.  
  5. #include <platform_impl.h>
  6. #include <IGem.h>
  7. #include <ISystem.h>
  8. #include <ILevelSystem.h>
  9.  
  10. #include <CrySystemBus.h>
  11.  
  12. #include <TestProject1SystemComponent.h>
  13.  
  14. namespace TestProject1
  15. {
  16.     class TestProject1Module
  17.         : public AZ::Module
  18.         , protected CrySystemEventBus::Handler
  19.         , protected ISystemEventListener
  20.     {
  21.     public:
  22.         AZ_RTTI(TestProject1Module, "{A41622CC-D3C7-40F8-9C42-52962315FEAE}", AZ::Module);
  23.         AZ_CLASS_ALLOCATOR(TestProject1Module, AZ::SystemAllocator, 0);
  24.  
  25.         TestProject1Module()
  26.             : AZ::Module()
  27.         {
  28.             CrySystemEventBus::Handler::BusConnect();
  29.  
  30.             // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  31.             m_descriptors.insert(m_descriptors.end(), {
  32.                 TestProject1SystemComponent::CreateDescriptor(),
  33.             });
  34.  
  35.         }
  36.  
  37.         ~TestProject1Module()
  38.         {
  39.             CrySystemEventBus::Handler::BusDisconnect();
  40.  
  41.             if (gEnv && gEnv->pSystem && gEnv->pSystem->GetISystemEventDispatcher())
  42.             {
  43.                 gEnv->pSystem->GetISystemEventDispatcher()->RemoveListener(this);
  44.             }
  45.         }
  46.  
  47.         /**
  48.          * Add required SystemComponents to the SystemEntity.
  49.          */
  50.         AZ::ComponentTypeList GetRequiredSystemComponents() const override
  51.         {
  52.             return AZ::ComponentTypeList{
  53.                 azrtti_typeid<TestProject1SystemComponent>(),
  54.             };
  55.         }
  56.  
  57.         void OnSystemEvent(ESystemEvent systemEvent, UINT_PTR wparam, UINT_PTR lparam)
  58.         {
  59.             switch (systemEvent)
  60.             {
  61.             case ESYSTEM_EVENT_GAME_POST_INIT_DONE:
  62.             {
  63.             }
  64.             break;
  65.             default:
  66.                 break;
  67.             }
  68.         }
  69.  
  70.     protected:
  71.         void OnCrySystemPreInitialize(ISystem& system, const SSystemInitParams& systemInitParams) override
  72.         {
  73.             (void)systemInitParams;
  74.             gEnv = system.GetGlobalEnvironment();
  75.         }
  76.  
  77.         void OnCrySystemInitialized(ISystem& system, const SSystemInitParams& systemInitParams) override
  78.         {
  79.             (void)systemInitParams;
  80.             system.GetISystemEventDispatcher()->RegisterListener(this);
  81.         }
  82.  
  83.         void OnCrySystemPostShutdown() override
  84.         {
  85.             gEnv = nullptr;
  86.         }
  87.     };
  88. }
  89.  
  90. // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
  91. // The first parameter should be GemName_GemIdLower
  92. // The second should be the fully qualified name of the class above
  93. AZ_DECLARE_MODULE_CLASS(TestProject1_67efe5a8ba3c4a4f8b5e55d86efb9cb7, TestProject1::TestProject1Module)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top