| | 1 | | using System; |
| | 2 | | using DCL.ECS7; |
| | 3 | | using DCL.ECSRuntime; |
| | 4 | | using DCLPlugins.ECSComponents; |
| | 5 | |
|
| | 6 | | namespace DCL.ECSComponents |
| | 7 | | { |
| | 8 | | public class ECS7ComponentsComposer : IDisposable |
| | 9 | | { |
| | 10 | | private readonly TransformRegister transformRegister; |
| | 11 | | private readonly AudioStreamRegister audioStreamRegister; |
| | 12 | | private readonly AudioSourceRegister audioSourceRegister; |
| | 13 | | private readonly GltfContainerRegister gltfRegister; |
| | 14 | | private readonly ECSTextShapeRegister textShapeRegister; |
| | 15 | | private readonly NFTShapeRegister nftRegister; |
| | 16 | | private readonly AnimatorRegister animatorRegister; |
| | 17 | | private readonly BillboardRegister billboardRegister; |
| | 18 | | private readonly AvatarShapeRegister avatarShapeRegister; |
| | 19 | | private readonly CameraModeAreaRegister cameraModeAreaRegister; |
| | 20 | | private readonly AvatarModifierAreaRegister avatarModifierAreaRegister; |
| | 21 | | private readonly AvatarAttachRegister avatarAttachRegister; |
| | 22 | | private readonly MaterialRegister materialRegister; |
| | 23 | | private readonly RaycastRegister raycastRegister; |
| | 24 | | private readonly RaycastResultRegister raycastResultRegister; |
| | 25 | | private readonly MeshRendererRegister meshRendererRegister; |
| | 26 | | private readonly MeshColliderRegister meshColliderRegister; |
| | 27 | | private readonly VisibilityComponentRegister visibilityComponentRegister; |
| | 28 | | private readonly PointerEventsRegister pointerEventsRegister; |
| | 29 | |
|
| | 30 | | // UI components |
| | 31 | | private readonly UITransformRegister uiTransformRegister; |
| | 32 | | private readonly UITextRegister uiTextRegister; |
| | 33 | |
|
| | 34 | | // Those components are only here to serialize over the wire, we don't need a handler for these |
| | 35 | | private readonly PointerEventResultRegister pointerEventResultRegister; |
| | 36 | | private readonly CameraModeRegister cameraModeRegister; |
| | 37 | | private readonly PointerLockRegister pointerLockRegister; |
| | 38 | |
|
| 26 | 39 | | public ECS7ComponentsComposer(ECSComponentsFactory componentsFactory, IECSComponentWriter componentsWriter, IInt |
| | 40 | | { |
| 26 | 41 | | transformRegister = new TransformRegister(ComponentID.TRANSFORM, componentsFactory, componentsWriter); |
| 26 | 42 | | audioStreamRegister = new AudioStreamRegister(ComponentID.AUDIO_STREAM, componentsFactory, componentsWriter) |
| 26 | 43 | | audioSourceRegister = new AudioSourceRegister(ComponentID.AUDIO_SOURCE, componentsFactory, componentsWriter) |
| 26 | 44 | | nftRegister = new NFTShapeRegister(ComponentID.NFT_SHAPE, componentsFactory, componentsWriter, internalCompo |
| 26 | 45 | | textShapeRegister = new ECSTextShapeRegister(ComponentID.TEXT_SHAPE, componentsFactory, componentsWriter); |
| 26 | 46 | | gltfRegister = new GltfContainerRegister(ComponentID.GLTF_CONTAINER, componentsFactory, componentsWriter, in |
| 26 | 47 | | animatorRegister = new AnimatorRegister(ComponentID.ANIMATOR, componentsFactory, componentsWriter); |
| 26 | 48 | | billboardRegister = new BillboardRegister(ComponentID.BILLBOARD, componentsFactory, componentsWriter); |
| 26 | 49 | | avatarAttachRegister = new AvatarAttachRegister(ComponentID.AVATAR_ATTACH, componentsFactory, componentsWrit |
| 26 | 50 | | avatarModifierAreaRegister = new AvatarModifierAreaRegister(ComponentID.AVATAR_MODIFIER_AREA, componentsFact |
| 26 | 51 | | avatarShapeRegister = new AvatarShapeRegister(ComponentID.AVATAR_SHAPE, componentsFactory, componentsWriter) |
| 26 | 52 | | cameraModeAreaRegister = new CameraModeAreaRegister(ComponentID.CAMERA_MODE_AREA, componentsFactory, compone |
| 26 | 53 | | materialRegister = new MaterialRegister(ComponentID.MATERIAL, componentsFactory, componentsWriter, internalC |
| 26 | 54 | | raycastRegister = new RaycastRegister(ComponentID.RAYCAST, componentsFactory, componentsWriter, internalComp |
| 26 | 55 | | raycastResultRegister = new RaycastResultRegister(ComponentID.RAYCAST_RESULT, componentsFactory, componentsW |
| 26 | 56 | | meshRendererRegister = new MeshRendererRegister(ComponentID.MESH_RENDERER, componentsFactory, componentsWrit |
| 26 | 57 | | meshColliderRegister = new MeshColliderRegister(ComponentID.MESH_COLLIDER, componentsFactory, componentsWrit |
| 26 | 58 | | visibilityComponentRegister = new VisibilityComponentRegister(ComponentID.VISIBILITY_COMPONENT, componentsFa |
| | 59 | |
|
| | 60 | | // UI components |
| 26 | 61 | | uiTransformRegister = new UITransformRegister(ComponentID.UI_TRANSFORM, componentsFactory, componentsWriter) |
| 26 | 62 | | uiTextRegister = new UITextRegister(ComponentID.UI_TEXT, componentsFactory, componentsWriter); |
| | 63 | |
|
| | 64 | | // Components without a handler |
| 26 | 65 | | pointerEventResultRegister = new PointerEventResultRegister(ComponentID.POINTER_EVENTS_RESULT, componentsFac |
| 26 | 66 | | cameraModeRegister = new CameraModeRegister(ComponentID.CAMERA_MODE, componentsFactory, componentsWriter); |
| 26 | 67 | | pointerLockRegister = new PointerLockRegister(ComponentID.POINTER_LOCK, componentsFactory, componentsWriter) |
| 26 | 68 | | pointerEventsRegister = new PointerEventsRegister(ComponentID.POINTER_EVENTS, componentsFactory, componentsW |
| 26 | 69 | | } |
| | 70 | |
|
| | 71 | | public void Dispose() |
| | 72 | | { |
| 13 | 73 | | transformRegister.Dispose(); |
| 13 | 74 | | billboardRegister.Dispose(); |
| 13 | 75 | | audioStreamRegister.Dispose(); |
| 13 | 76 | | audioSourceRegister.Dispose(); |
| 13 | 77 | | textShapeRegister.Dispose(); |
| 13 | 78 | | nftRegister.Dispose(); |
| 13 | 79 | | gltfRegister.Dispose(); |
| 13 | 80 | | animatorRegister.Dispose(); |
| 13 | 81 | | avatarAttachRegister.Dispose(); |
| 13 | 82 | | avatarModifierAreaRegister.Dispose(); |
| 13 | 83 | | avatarShapeRegister.Dispose(); |
| 13 | 84 | | cameraModeAreaRegister.Dispose(); |
| 13 | 85 | | materialRegister.Dispose(); |
| 13 | 86 | | raycastRegister.Dispose(); |
| 13 | 87 | | raycastResultRegister.Dispose(); |
| 13 | 88 | | meshRendererRegister.Dispose(); |
| 13 | 89 | | meshColliderRegister.Dispose(); |
| 13 | 90 | | visibilityComponentRegister.Dispose(); |
| | 91 | |
|
| | 92 | | // UI components |
| 13 | 93 | | uiTransformRegister.Dispose(); |
| 13 | 94 | | uiTextRegister.Dispose(); |
| | 95 | |
|
| | 96 | | // Components without a handler |
| 13 | 97 | | pointerEventResultRegister.Dispose(); |
| 13 | 98 | | cameraModeRegister.Dispose(); |
| 13 | 99 | | pointerLockRegister.Dispose(); |
| 13 | 100 | | pointerEventsRegister.Dispose(); |
| 13 | 101 | | } |
| | 102 | | } |
| | 103 | | } |