| | 1 | | using DCL.ECS7; |
| | 2 | | using DCL.ECSComponents.UIDropdown; |
| | 3 | | using DCL.ECSComponents.UIInput; |
| | 4 | | using DCL.ECSComponents.UIText; |
| | 5 | | using DCL.ECSRuntime; |
| | 6 | | using DCLPlugins.ECSComponents; |
| | 7 | | using System; |
| | 8 | |
|
| | 9 | | namespace DCL.ECSComponents |
| | 10 | | { |
| | 11 | | public class ECS7ComponentsComposer : IDisposable |
| | 12 | | { |
| | 13 | | private readonly TransformRegister transformRegister; |
| | 14 | | private readonly AudioStreamRegister audioStreamRegister; |
| | 15 | | private readonly AudioSourceRegister audioSourceRegister; |
| | 16 | | private readonly GltfContainerRegister gltfRegister; |
| | 17 | | private readonly ECSTextShapeRegister textShapeRegister; |
| | 18 | | private readonly NFTShapeRegister nftRegister; |
| | 19 | | private readonly AnimatorRegister animatorRegister; |
| | 20 | | private readonly BillboardRegister billboardRegister; |
| | 21 | | private readonly AvatarShapeRegister avatarShapeRegister; |
| | 22 | | private readonly CameraModeAreaRegister cameraModeAreaRegister; |
| | 23 | | private readonly AvatarModifierAreaRegister avatarModifierAreaRegister; |
| | 24 | | private readonly AvatarAttachRegister avatarAttachRegister; |
| | 25 | | private readonly MaterialRegister materialRegister; |
| | 26 | | private readonly RaycastRegister raycastRegister; |
| | 27 | | private readonly RaycastResultRegister raycastResultRegister; |
| | 28 | | private readonly MeshRendererRegister meshRendererRegister; |
| | 29 | | private readonly MeshColliderRegister meshColliderRegister; |
| | 30 | | private readonly VisibilityComponentRegister visibilityComponentRegister; |
| | 31 | | private readonly PointerEventsRegister pointerEvents; |
| | 32 | | private readonly VideoPlayerRegister videoPlayerRegister; |
| | 33 | | private readonly TweenRegister tweenRegister; |
| | 34 | |
|
| | 35 | | // UI components |
| | 36 | | private readonly UITransformRegister uiTransformRegister; |
| | 37 | | private readonly UiTextRegister uiTextRegister; |
| | 38 | | private readonly UIBackgroundRegister uiBackgroundRegister; |
| | 39 | | private readonly UIInputRegister uiInputRegister; |
| | 40 | | private readonly UIDropdownRegister uiDropdownRegister; |
| | 41 | |
|
| | 42 | | // Those components are only here to serialize over the wire, we don't need a handler for these |
| | 43 | | private readonly PointerEventResultRegister pointerEventResultRegister; |
| | 44 | | private readonly CameraModeRegister cameraModeRegister; |
| | 45 | | private readonly PointerLockRegister pointerLockRegister; |
| | 46 | | private readonly VideoEventRegister videoEventRegister; |
| | 47 | | private readonly GltfContainerLoadingStateRegister gltfContainerLoadingStateRegister; |
| | 48 | | private readonly EngineInfoRegister engineInfoRegister; |
| | 49 | | private readonly UiCanvasInformationRegister uiCanvasInformationRegister; |
| | 50 | | private readonly TweenStateRegister tweenStateRegister; |
| | 51 | |
|
| 2 | 52 | | public ECS7ComponentsComposer(ECSComponentsFactory componentsFactory, IECSComponentWriter componentsWriter, IInt |
| | 53 | | { |
| 2 | 54 | | transformRegister = new TransformRegister(ComponentID.TRANSFORM, componentsFactory, componentsWriter, intern |
| 2 | 55 | | audioStreamRegister = new AudioStreamRegister(ComponentID.AUDIO_STREAM, componentsFactory, componentsWriter) |
| 2 | 56 | | audioSourceRegister = new AudioSourceRegister(ComponentID.AUDIO_SOURCE, componentsFactory, componentsWriter, |
| 2 | 57 | | nftRegister = new NFTShapeRegister(ComponentID.NFT_SHAPE, componentsFactory, componentsWriter, internalCompo |
| 2 | 58 | | textShapeRegister = new ECSTextShapeRegister(ComponentID.TEXT_SHAPE, componentsFactory, componentsWriter, in |
| 2 | 59 | | gltfRegister = new GltfContainerRegister(ComponentID.GLTF_CONTAINER, componentsFactory, componentsWriter, in |
| 2 | 60 | | animatorRegister = new AnimatorRegister(ComponentID.ANIMATOR, componentsFactory, componentsWriter, internalC |
| 2 | 61 | | billboardRegister = new BillboardRegister(ComponentID.BILLBOARD, componentsFactory, componentsWriter); |
| 2 | 62 | | avatarAttachRegister = new AvatarAttachRegister(ComponentID.AVATAR_ATTACH, componentsFactory, componentsWrit |
| 2 | 63 | | avatarModifierAreaRegister = new AvatarModifierAreaRegister(ComponentID.AVATAR_MODIFIER_AREA, componentsFact |
| 2 | 64 | | avatarShapeRegister = new AvatarShapeRegister(ComponentID.AVATAR_SHAPE, componentsFactory, componentsWriter, |
| 2 | 65 | | cameraModeAreaRegister = new CameraModeAreaRegister(ComponentID.CAMERA_MODE_AREA, componentsFactory, compone |
| 2 | 66 | | materialRegister = new MaterialRegister(ComponentID.MATERIAL, componentsFactory, componentsWriter, internalC |
| 2 | 67 | | raycastRegister = new RaycastRegister(ComponentID.RAYCAST, componentsFactory, componentsWriter, internalComp |
| 2 | 68 | | raycastResultRegister = new RaycastResultRegister(ComponentID.RAYCAST_RESULT, componentsFactory, componentsW |
| 2 | 69 | | meshRendererRegister = new MeshRendererRegister(ComponentID.MESH_RENDERER, componentsFactory, componentsWrit |
| 2 | 70 | | meshColliderRegister = new MeshColliderRegister(ComponentID.MESH_COLLIDER, componentsFactory, componentsWrit |
| 2 | 71 | | visibilityComponentRegister = new VisibilityComponentRegister(ComponentID.VISIBILITY_COMPONENT, componentsFa |
| 2 | 72 | | videoPlayerRegister = new VideoPlayerRegister(ComponentID.VIDEO_PLAYER, componentsFactory, componentsWriter, |
| 2 | 73 | | videoEventRegister = new VideoEventRegister(ComponentID.VIDEO_EVENT, componentsFactory, componentsWriter); |
| 2 | 74 | | tweenRegister = new TweenRegister(ComponentID.TWEEN, componentsFactory, componentsWriter, internalComponents |
| | 75 | |
|
| | 76 | | // Multi-purposed components |
| 2 | 77 | | pointerEvents = new PointerEventsRegister(ComponentID.POINTER_EVENTS, componentsFactory, componentsWriter, i |
| | 78 | |
|
| | 79 | | // UI components |
| 2 | 80 | | uiTransformRegister = new UITransformRegister(ComponentID.UI_TRANSFORM, componentsFactory, componentsWriter, |
| 2 | 81 | | uiTextRegister = new UiTextRegister(ComponentID.UI_TEXT, componentsFactory, componentsWriter, internalCompon |
| 2 | 82 | | uiBackgroundRegister = new UIBackgroundRegister(ComponentID.UI_BACKGROUND, componentsFactory, componentsWrit |
| 2 | 83 | | uiInputRegister = new UIInputRegister(ComponentID.UI_INPUT, ComponentID.UI_INPUT_RESULT, componentsFactory, |
| 2 | 84 | | uiDropdownRegister = new UIDropdownRegister(ComponentID.UI_DROPDOWN, ComponentID.UI_DROPDOWN_RESULT, compone |
| | 85 | |
|
| | 86 | | // Components without a handler |
| 2 | 87 | | pointerEventResultRegister = new PointerEventResultRegister(ComponentID.POINTER_EVENTS_RESULT, componentsFac |
| 2 | 88 | | cameraModeRegister = new CameraModeRegister(ComponentID.CAMERA_MODE, componentsFactory, componentsWriter); |
| 2 | 89 | | pointerLockRegister = new PointerLockRegister(ComponentID.POINTER_LOCK, componentsFactory, componentsWriter) |
| 2 | 90 | | gltfContainerLoadingStateRegister = new GltfContainerLoadingStateRegister(ComponentID.GLTF_CONTAINER_LOADING |
| 2 | 91 | | engineInfoRegister = new EngineInfoRegister(ComponentID.ENGINE_INFO, componentsFactory, componentsWriter); |
| 2 | 92 | | uiCanvasInformationRegister = new UiCanvasInformationRegister(ComponentID.UI_CANVAS_INFORMATION, componentsF |
| 2 | 93 | | tweenStateRegister = new TweenStateRegister(ComponentID.TWEEN_STATE, componentsFactory, componentsWriter); |
| 2 | 94 | | } |
| | 95 | |
|
| | 96 | | public void Dispose() |
| | 97 | | { |
| 1 | 98 | | transformRegister.Dispose(); |
| 1 | 99 | | billboardRegister.Dispose(); |
| 1 | 100 | | audioStreamRegister.Dispose(); |
| 1 | 101 | | audioSourceRegister.Dispose(); |
| 1 | 102 | | textShapeRegister.Dispose(); |
| 1 | 103 | | nftRegister.Dispose(); |
| 1 | 104 | | gltfRegister.Dispose(); |
| 1 | 105 | | animatorRegister.Dispose(); |
| 1 | 106 | | avatarAttachRegister.Dispose(); |
| 1 | 107 | | avatarModifierAreaRegister.Dispose(); |
| 1 | 108 | | avatarShapeRegister.Dispose(); |
| 1 | 109 | | cameraModeAreaRegister.Dispose(); |
| 1 | 110 | | materialRegister.Dispose(); |
| 1 | 111 | | raycastRegister.Dispose(); |
| 1 | 112 | | raycastResultRegister.Dispose(); |
| 1 | 113 | | meshRendererRegister.Dispose(); |
| 1 | 114 | | meshColliderRegister.Dispose(); |
| 1 | 115 | | visibilityComponentRegister.Dispose(); |
| 1 | 116 | | videoPlayerRegister.Dispose(); |
| 1 | 117 | | tweenRegister.Dispose(); |
| | 118 | |
|
| | 119 | | // UI components |
| 1 | 120 | | uiTransformRegister.Dispose(); |
| 1 | 121 | | uiTextRegister.Dispose(); |
| 1 | 122 | | uiBackgroundRegister.Dispose(); |
| 1 | 123 | | uiInputRegister.Dispose(); |
| 1 | 124 | | uiDropdownRegister.Dispose(); |
| | 125 | |
|
| | 126 | | // Components without a handler |
| 1 | 127 | | pointerEventResultRegister.Dispose(); |
| 1 | 128 | | cameraModeRegister.Dispose(); |
| 1 | 129 | | pointerLockRegister.Dispose(); |
| 1 | 130 | | pointerEvents.Dispose(); |
| 1 | 131 | | gltfContainerLoadingStateRegister.Dispose(); |
| 1 | 132 | | videoEventRegister.Dispose(); |
| 1 | 133 | | engineInfoRegister.Dispose(); |
| 1 | 134 | | uiCanvasInformationRegister.Dispose(); |
| 1 | 135 | | tweenStateRegister.Dispose(); |
| 1 | 136 | | } |
| | 137 | | } |
| | 138 | | } |