MultiplayerSampleModule.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * 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.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #include <AzCore/Memory/SystemAllocator.h>
  8. #include <AzCore/Module/Module.h>
  9. #include <Components/AttachPlayerWeaponComponent.h>
  10. #include <Components/ExampleFilteredEntityComponent.h>
  11. #include <Components/OcclusionFilteredEntityComponent.h>
  12. #include <Components/PerfTest/NetworkPrefabSpawnerComponent.h>
  13. #include <Components/UI/UiCoinCountComponent.h>
  14. #include <Components/UI/UiGameOverComponent.h>
  15. #include <Components/UI/UiPlayerArmorComponent.h>
  16. #include <Components/BackgroundMusicComponent.h>
  17. #include <Components/ScriptableDecalComponent.h>
  18. #include <Source/AutoGen/AutoComponentTypes.h>
  19. #include <MultiplayerSampleSystemComponent.h>
  20. #if AZ_TRAIT_CLIENT
  21. # include <Components/UI/HUDComponent.h>
  22. # include <Components/UI/UiMatchPlayerCoinCountsComponent.h>
  23. # include <Components/UI/UiRestBetweenRoundsComponent.h>
  24. # include <Components/UI/UiSettingsComponent.h>
  25. # include <Components/UI/UiStartMenuComponent.h>
  26. #include <UserSettings/MultiplayerSampleUserSettings.h>
  27. #endif
  28. namespace MultiplayerSample
  29. {
  30. class MultiplayerSampleModule
  31. : public AZ::Module
  32. {
  33. public:
  34. AZ_RTTI(MultiplayerSampleModule, "{9323FFB1-54AB-4665-889B-166CA2418C7C}", AZ::Module);
  35. AZ_CLASS_ALLOCATOR(MultiplayerSampleModule, AZ::SystemAllocator, 0);
  36. MultiplayerSampleModule()
  37. : AZ::Module()
  38. {
  39. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  40. m_descriptors.insert(m_descriptors.end(), {
  41. MultiplayerSampleSystemComponent::CreateDescriptor(),
  42. AttachPlayerWeaponComponent::CreateDescriptor(),
  43. ExampleFilteredEntityComponent::CreateDescriptor(),
  44. OcclusionFilteredEntityComponent::CreateDescriptor(),
  45. NetworkPrefabSpawnerComponent::CreateDescriptor(),
  46. UiCoinCountComponent::CreateDescriptor(),
  47. BackgroundMusicComponent::CreateDescriptor(),
  48. ScriptableDecalComponent::CreateDescriptor(),
  49. #if AZ_TRAIT_CLIENT
  50. HUDComponent::CreateDescriptor(),
  51. UiGameOverComponent::CreateDescriptor(),
  52. UiPlayerArmorComponent::CreateDescriptor(),
  53. UiMatchPlayerCoinCountsComponent::CreateDescriptor(),
  54. UiRestBetweenRoundsComponent::CreateDescriptor(),
  55. UiSettingsComponent::CreateDescriptor(),
  56. UiStartMenuComponent::CreateDescriptor(),
  57. #endif
  58. });
  59. CreateComponentDescriptors(m_descriptors);
  60. }
  61. /**
  62. * Add required SystemComponents to the SystemEntity.
  63. */
  64. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  65. {
  66. return AZ::ComponentTypeList{
  67. azrtti_typeid<MultiplayerSampleSystemComponent>(),
  68. };
  69. }
  70. #if AZ_TRAIT_CLIENT
  71. // This needs to be created as a part of the MultiplayerSampleModule, not during any sort of System Component activation.
  72. // It will affect registry keys that get read by System Components as a part of their activation and we can't guarantee
  73. // that those other core System Components will get started after our game-specific one.
  74. MultiplayerSampleUserSettings m_userSettings;
  75. #endif
  76. };
  77. }
  78. // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
  79. // The first parameter should be GemName_GemIdLower
  80. // The second should be the fully qualified name of the class above
  81. #if defined(AZ_MONOLITHIC_BUILD)
  82. AZ_DECLARE_MODULE_CLASS(Gem_MultiplayerSample_Client, MultiplayerSample::MultiplayerSampleModule);
  83. AZ_DECLARE_MODULE_CLASS(Gem_MultiplayerSample_Server, MultiplayerSample::MultiplayerSampleModule);
  84. #endif
  85. AZ_DECLARE_MODULE_CLASS(Gem_MultiplayerSample, MultiplayerSample::MultiplayerSampleModule)