< Summary

Class:DCL.ECSComponentsManagerLegacy
Assembly:ECSComponentManagerLegacy
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/ECSComponentManagerLegacy/ECSComponentsManagerLegacy.cs
Covered lines:175
Uncovered lines:78
Coverable lines:253
Total lines:638
Line coverage:69.1% (175 of 253)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ECSComponentsManagerLegacy(...)0%110100%
ECSComponentsManagerLegacy(...)0%110100%
AddSharedComponent(...)0%3.023087.5%
RemoveSharedComponent(...)0%6.026091.67%
TryGetComponent[T](...)0%56700%
TryGetBaseComponent(...)0%220100%
TryGetSharedComponent(...)0%20400%
GetSharedComponent(...)0%3.073080%
HasComponent(...)0%220100%
HasSharedComponent(...)0%6200%
RemoveComponent(...)0%330100%
AddComponent(...)0%330100%
GetComponent(...)0%3.583060%
GetComponents()0%30500%
GetSharedComponents()0%30500%
GetComponentsDictionary(...)0%110100%
GetSharedComponentsDictionary(...)0%2100%
GetComponentsCount()0%6200%
CleanComponents(...)0%770100%
HasSceneSharedComponent(...)0%110100%
GetSceneSharedComponent(...)0%110100%
TryGetSceneSharedComponent(...)0%2100%
GetSceneSharedComponentsDictionary()0%110100%
GetSceneSharedComponentsCount()0%110100%
AddSceneSharedComponent(...)0%220100%
RemoveSceneSharedComponent(...)0%2100%
SceneSharedComponentCreate(...)0%5.125083.33%
GetSceneSharedComponent[T]()0%220100%
SceneSharedComponentAttach(...)0%3.043083.33%
EntityComponentCreateOrUpdate(...)0%11.1511089.29%
EntityComponentUpdate(...)0%3.793055.56%
SceneSharedComponentDispose(...)0%330100%
SceneSharedComponentUpdate(...)0%4.683042.86%
SceneSharedComponentUpdate(...)0%4.683042.86%
EntityComponentRemove(...)0%38.5932081.4%
DisposeAllSceneComponents()0%330100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/ECSComponentManagerLegacy/ECSComponentsManagerLegacy.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using DCL.Components;
 5using DCL.Controllers;
 6using DCL.Helpers;
 7using DCL.Models;
 8using DCL.Rendering;
 9using UnityEngine;
 10
 11namespace DCL
 12{
 13    public class ECSComponentsManagerLegacy : IECSComponentsManagerLegacy
 14    {
 39315        private readonly Dictionary<string, ISharedComponent> disposableComponents = new Dictionary<string, ISharedCompo
 16
 39317        private readonly Dictionary<long, Dictionary<Type, ISharedComponent>> entitiesSharedComponents =
 18            new Dictionary<long, Dictionary<Type, ISharedComponent>>();
 19
 39320        private readonly Dictionary<long, Dictionary<CLASS_ID_COMPONENT, IEntityComponent>> entitiesComponents =
 21            new Dictionary<long, Dictionary<CLASS_ID_COMPONENT, IEntityComponent>>();
 22
 23        private readonly IParcelScene scene;
 24        private readonly IRuntimeComponentFactory componentFactory;
 25        private readonly IParcelScenesCleaner parcelScenesCleaner;
 26        private readonly ISceneBoundsChecker sceneBoundsChecker;
 27        private readonly IPhysicsSyncController physicsSyncController;
 28        private readonly ICullingController cullingController;
 29        private readonly DataStore_FeatureFlag dataStoreFeatureFlag;
 30        private readonly bool isSBCNerfEnabled;
 31
 32        public event Action<string, ISharedComponent> OnAddSharedComponent;
 33
 34        public ECSComponentsManagerLegacy(IParcelScene scene)
 39335            : this(scene,
 36                Environment.i.world.componentFactory,
 37                Environment.i.platform.parcelScenesCleaner,
 38                Environment.i.world.sceneBoundsChecker,
 39                Environment.i.platform.physicsSyncController,
 40                Environment.i.platform.cullingController,
 39341                DataStore.i.featureFlags.flags.Get()) { }
 42
 39343        public ECSComponentsManagerLegacy(IParcelScene scene,
 44            IRuntimeComponentFactory componentFactory,
 45            IParcelScenesCleaner parcelScenesCleaner,
 46            ISceneBoundsChecker sceneBoundsChecker,
 47            IPhysicsSyncController physicsSyncController,
 48            ICullingController cullingController,
 49            FeatureFlag featureFlags)
 50        {
 39351            this.scene = scene;
 39352            this.componentFactory = componentFactory;
 39353            this.parcelScenesCleaner = parcelScenesCleaner;
 39354            this.sceneBoundsChecker = sceneBoundsChecker;
 39355            this.physicsSyncController = physicsSyncController;
 39356            this.cullingController = cullingController;
 57
 39358            isSBCNerfEnabled = featureFlags.IsFeatureEnabled("NERF_SBC");
 39359        }
 60
 61        public void AddSharedComponent(IDCLEntity entity, Type componentType, ISharedComponent component)
 62        {
 36763            if (component == null)
 64            {
 065                return;
 66            }
 67
 36768            RemoveSharedComponent(entity, componentType);
 69
 36770            if (!entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComp
 71            {
 27372                entityComponents = new Dictionary<Type, ISharedComponent>();
 27373                entitiesSharedComponents.Add(entity.entityId, entityComponents);
 74            }
 75
 36776            entityComponents.Add(componentType, component);
 36777        }
 78
 79        public void RemoveSharedComponent(IDCLEntity entity, Type targetType, bool triggerDetaching = true)
 80        {
 73481            if (!entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComp
 82            {
 29383                return;
 84            }
 44185            if (!entityComponents.TryGetValue(targetType, out ISharedComponent component))
 86            {
 14187                return;
 88            }
 30089            if (component == null)
 090                return;
 91
 30092            entityComponents.Remove(targetType);
 93
 30094            if (entityComponents.Count == 0)
 95            {
 21396                entitiesSharedComponents.Remove(entity.entityId);
 97            }
 98
 30099            if (triggerDetaching)
 31100                component.DetachFrom(entity, targetType);
 300101        }
 102
 103        public T TryGetComponent<T>(IDCLEntity entity) where T : class
 104        {
 0105            T component = null;
 0106            if (entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> ent
 107            {
 0108                component = entityComponents.Values.FirstOrDefault(x => x is T) as T;
 109
 0110                if (component != null)
 0111                    return component;
 112            }
 113
 0114            if (entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityShare
 115            {
 0116                component = entitySharedComponents.Values.FirstOrDefault(x => x is T) as T;
 117
 0118                if (component != null)
 0119                    return component;
 120            }
 121
 0122            return null;
 123        }
 124
 125        public bool TryGetBaseComponent(IDCLEntity entity, CLASS_ID_COMPONENT componentId, out IEntityComponent componen
 126        {
 249127            if (entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> ent
 128            {
 69129                return entityComponents.TryGetValue(componentId, out component);
 130            }
 180131            component = null;
 180132            return false;
 133        }
 134
 135        public bool TryGetSharedComponent(IDCLEntity entity, CLASS_ID componentId, out ISharedComponent component)
 136        {
 0137            component = null;
 0138            if (!entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComp
 139            {
 0140                return false;
 141            }
 142
 0143            using (var iterator = entityComponents.GetEnumerator())
 144            {
 0145                while (iterator.MoveNext())
 146                {
 0147                    if (iterator.Current.Value.GetClassId() != (int)componentId)
 148                        continue;
 149
 0150                    component = iterator.Current.Value;
 0151                    break;
 152                }
 0153            }
 154
 0155            return component != null;
 156        }
 157
 158        public ISharedComponent GetSharedComponent(IDCLEntity entity, Type targetType)
 159        {
 68160            if (!entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComp
 161            {
 11162                return null;
 163            }
 164
 57165            if (entityComponents.TryGetValue(targetType, out ISharedComponent component))
 166            {
 57167                return component;
 168            }
 169
 0170            return null;
 171        }
 172
 173        public bool HasComponent(IDCLEntity entity, CLASS_ID_COMPONENT componentId)
 174        {
 819175            if (entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> ent
 176            {
 444177                return entityComponents.ContainsKey(componentId);
 178            }
 375179            return false;
 180        }
 181
 182        public bool HasSharedComponent(IDCLEntity entity, CLASS_ID componentId)
 183        {
 0184            if (TryGetSharedComponent(entity, componentId, out ISharedComponent component))
 185            {
 0186                return component != null;
 187            }
 0188            return false;
 189        }
 190
 191        public void RemoveComponent(IDCLEntity entity, CLASS_ID_COMPONENT componentId)
 192        {
 22193            if (entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> ent
 194            {
 22195                entityComponents.Remove(componentId);
 196
 22197                if (entityComponents.Count == 0)
 198                {
 17199                    entitiesComponents.Remove(entity.entityId);
 200                }
 201            }
 22202        }
 203
 204        public void AddComponent(IDCLEntity entity, CLASS_ID_COMPONENT componentId, IEntityComponent component)
 205        {
 308206            if (!entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> en
 207            {
 262208                entityComponents = new Dictionary<CLASS_ID_COMPONENT, IEntityComponent>();
 262209                entitiesComponents.Add(entity.entityId, entityComponents);
 210
 262211                entity.OnBaseComponentAdded?.Invoke(componentId, entity);
 212            }
 308213            entityComponents.Add(componentId, component);
 308214        }
 215
 216        public IEntityComponent GetComponent(IDCLEntity entity, CLASS_ID_COMPONENT componentId)
 217        {
 103218            if (!entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> en
 219            {
 0220                return null;
 221            }
 103222            if (entityComponents.TryGetValue(componentId, out IEntityComponent component))
 223            {
 103224                return component;
 225            }
 0226            return null;
 227        }
 228
 229        public IEnumerator<IEntityComponent> GetComponents(IDCLEntity entity)
 230        {
 0231            if (!entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> en
 232            {
 0233                yield break;
 234            }
 235
 0236            using (var iterator = entityComponents.GetEnumerator())
 237            {
 0238                while (iterator.MoveNext())
 239                {
 0240                    yield return iterator.Current.Value;
 241                }
 0242            }
 0243        }
 244
 245        public IEnumerator<ISharedComponent> GetSharedComponents(IDCLEntity entity)
 246        {
 0247            if (!entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComp
 248            {
 0249                yield break;
 250            }
 251
 0252            using (var iterator = entityComponents.GetEnumerator())
 253            {
 0254                while (iterator.MoveNext())
 255                {
 0256                    yield return iterator.Current.Value;
 257                }
 0258            }
 0259        }
 260
 261        public IReadOnlyDictionary<CLASS_ID_COMPONENT, IEntityComponent> GetComponentsDictionary(IDCLEntity entity)
 262        {
 30263            entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> entityC
 30264            return entityComponents;
 265        }
 266
 267        public IReadOnlyDictionary<Type, ISharedComponent> GetSharedComponentsDictionary(IDCLEntity entity)
 268        {
 0269            entitiesSharedComponents.TryGetValue(entity.entityId, out Dictionary<Type, ISharedComponent> entityComponent
 0270            return entityComponents;
 271        }
 272
 273        public int GetComponentsCount()
 274        {
 0275            int count = 0;
 0276            using (var entityIterator = entitiesComponents.GetEnumerator())
 277            {
 0278                while (entityIterator.MoveNext())
 279                {
 0280                    count += entityIterator.Current.Value.Count;
 281                }
 0282            }
 0283            return count;
 284        }
 285
 286        public void CleanComponents(IDCLEntity entity)
 287        {
 245288            if (!entitiesComponents.TryGetValue(entity.entityId, out Dictionary<CLASS_ID_COMPONENT, IEntityComponent> en
 289            {
 67290                return;
 291            }
 292
 178293            using (var iterator = entityComponents.GetEnumerator())
 294            {
 373295                while (iterator.MoveNext())
 296                {
 195297                    if (iterator.Current.Value == null)
 298                        continue;
 299
 195300                    if (iterator.Current.Value is ICleanable cleanableComponent)
 195301                        cleanableComponent.Cleanup();
 302
 195303                    if (!(iterator.Current.Value is IPoolableObjectContainer poolableContainer))
 304                        continue;
 305
 48306                    if (poolableContainer.poolableObject == null)
 307                        continue;
 308
 4309                    poolableContainer.poolableObject.Release();
 310                }
 178311            }
 178312            entitiesComponents.Remove(entity.entityId);
 178313        }
 314
 315        public bool HasSceneSharedComponent(string component)
 316        {
 189317            return disposableComponents.ContainsKey(component);
 318        }
 319
 320        public ISharedComponent GetSceneSharedComponent(string component)
 321        {
 800322            disposableComponents.TryGetValue(component, out ISharedComponent sharedComponent);
 800323            return sharedComponent;
 324        }
 325
 326        public bool TryGetSceneSharedComponent(string component, out ISharedComponent sharedComponent)
 327        {
 0328            return disposableComponents.TryGetValue(component, out sharedComponent);
 329        }
 330
 331        public IReadOnlyDictionary<string, ISharedComponent> GetSceneSharedComponentsDictionary()
 332        {
 3333            return disposableComponents;
 334        }
 335
 336        public int GetSceneSharedComponentsCount()
 337        {
 351338            return disposableComponents.Count;
 339        }
 340
 341        public void AddSceneSharedComponent(string component, ISharedComponent sharedComponent)
 342        {
 554343            disposableComponents.Add(component, sharedComponent);
 554344            OnAddSharedComponent?.Invoke(component, sharedComponent);
 4345        }
 346
 347        public bool RemoveSceneSharedComponent(string component)
 348        {
 0349            return disposableComponents.Remove(component);
 350        }
 351
 352        public ISharedComponent SceneSharedComponentCreate(string id, int classId)
 353        {
 551354            if (disposableComponents.TryGetValue(id, out ISharedComponent component))
 1355                return component;
 356
 550357            IRuntimeComponentFactory factory = componentFactory;
 358
 550359            if (factory.createConditions.ContainsKey(classId))
 360            {
 44361                if (!factory.createConditions[(int)classId].Invoke(scene.sceneData.sceneNumber, classId))
 0362                    return null;
 363            }
 364
 550365            ISharedComponent newComponent = componentFactory.CreateComponent(classId) as ISharedComponent;
 366
 550367            if (newComponent == null)
 0368                return null;
 369
 550370            AddSceneSharedComponent(id, newComponent);
 371
 550372            newComponent.Initialize(scene, id);
 373
 550374            return newComponent;
 375        }
 376
 377        public T GetSceneSharedComponent<T>() where T : class
 378        {
 123379            return disposableComponents.Values.FirstOrDefault(x => x is T) as T;
 380        }
 381
 382        /**
 383          * This method is called when we need to attach a disposable component to the entity
 384          */
 385        public void SceneSharedComponentAttach(long entityId, string componentId)
 386        {
 367387            IDCLEntity entity = scene.GetEntityById(entityId);
 388
 367389            if (entity == null)
 0390                return;
 391
 367392            if (disposableComponents.TryGetValue(componentId, out ISharedComponent sharedComponent))
 393            {
 367394                sharedComponent.AttachTo(entity);
 395            }
 367396        }
 397
 398        public IEntityComponent EntityComponentCreateOrUpdate(long entityId, CLASS_ID_COMPONENT classId, object data)
 399        {
 384400            IDCLEntity entity = scene.GetEntityById(entityId);
 401
 384402            if (entity == null)
 403            {
 0404                Debug.LogError($"scene '{scene.sceneData.sceneNumber}': Can't create entity component if the entity {ent
 0405                return null;
 406            }
 407
 384408            IEntityComponent targetComponent = null;
 409
 384410            var overrideCreate = Environment.i.world.componentFactory.createOverrides;
 411
 384412            if (overrideCreate.ContainsKey((int)classId))
 413            {
 312414                int classIdAsInt = (int)classId;
 312415                overrideCreate[(int)classId].Invoke(scene.sceneData.sceneNumber, entityId, ref classIdAsInt, data);
 312416                classId = (CLASS_ID_COMPONENT)classIdAsInt;
 417            }
 418
 384419            bool wasCreated = false;
 384420            if (!HasComponent(entity, classId))
 421            {
 307422                targetComponent = componentFactory.CreateComponent((int) classId) as IEntityComponent;
 423
 307424                if (targetComponent != null)
 425                {
 307426                    AddComponent(entity, classId, targetComponent);
 427
 307428                    targetComponent.Initialize(scene, entity);
 429
 307430                    if (data is string json)
 307431                        targetComponent.UpdateFromJSON(json);
 432                    else
 0433                        targetComponent.UpdateFromModel(data as BaseModel);
 434
 307435                    wasCreated = true;
 436                }
 437            }
 438            else
 439            {
 77440                targetComponent = EntityComponentUpdate(entity, classId, data as string);
 441            }
 442
 384443            var isTransform = classId == CLASS_ID_COMPONENT.TRANSFORM;
 384444            var avoidThrottling = isSBCNerfEnabled ? isTransform && wasCreated : isTransform;
 445
 384446            if (targetComponent != null && targetComponent is IOutOfSceneBoundariesHandler)
 322447                sceneBoundsChecker?.AddEntityToBeChecked(entity, runPreliminaryEvaluation: avoidThrottling);
 448
 384449            physicsSyncController.MarkDirty();
 384450            cullingController.MarkDirty();
 451
 384452            return targetComponent;
 453        }
 454
 455        public IEntityComponent EntityComponentUpdate(IDCLEntity entity, CLASS_ID_COMPONENT classId,
 456            string componentJson)
 457        {
 101458            if (entity == null)
 459            {
 0460                Debug.LogError($"Can't update the {classId} component of a nonexistent entity!", scene.GetSceneTransform
 0461                return null;
 462            }
 463
 101464            if (!HasComponent(entity, classId))
 465            {
 0466                Debug.LogError($"Entity {entity.entityId} doesn't have a {classId} component to update!", scene.GetScene
 0467                return null;
 468            }
 469
 101470            var targetComponent = GetComponent(entity, classId);
 101471            targetComponent.UpdateFromJSON(componentJson);
 472
 101473            return targetComponent;
 474        }
 475
 476        public void SceneSharedComponentDispose(string id)
 477        {
 90478            if (disposableComponents.TryGetValue(id, out ISharedComponent sharedComponent))
 479            {
 90480                sharedComponent?.Dispose();
 90481                disposableComponents.Remove(id);
 482            }
 90483        }
 484
 485        public ISharedComponent SceneSharedComponentUpdate(string id, BaseModel model)
 486        {
 33487            if (disposableComponents.TryGetValue(id, out ISharedComponent sharedComponent))
 488            {
 33489                sharedComponent.UpdateFromModel(model);
 33490                return sharedComponent;
 491            }
 492
 0493            if (scene.GetSceneTransform() == null)
 494            {
 0495                Debug.LogError($"Unknown disposableComponent {id} -- scene has been destroyed?");
 496            }
 497            else
 498            {
 0499                Debug.LogError($"Unknown disposableComponent {id}", scene.GetSceneTransform());
 500            }
 501
 0502            return null;
 503        }
 504
 505        public ISharedComponent SceneSharedComponentUpdate(string id, string json)
 506        {
 690507            if (disposableComponents.TryGetValue(id, out ISharedComponent disposableComponent))
 508            {
 690509                disposableComponent.UpdateFromJSON(json);
 690510                return disposableComponent;
 511            }
 512
 0513            if (scene.GetSceneTransform() == null)
 514            {
 0515                Debug.LogError($"Unknown disposableComponent {id} -- scene has been destroyed?");
 516            }
 517            else
 518            {
 0519                Debug.LogError($"Unknown disposableComponent {id}", scene.GetSceneTransform());
 520            }
 521
 0522            return null;
 523        }
 524
 525        public void EntityComponentRemove(long entityId, string componentName)
 526        {
 37527            IDCLEntity entity = scene.GetEntityById(entityId);
 528
 37529            if (entity == null)
 530            {
 0531                return;
 532            }
 533
 534            switch (componentName)
 535            {
 536                case "shape":
 0537                    if (entity.meshesInfo.currentShape is BaseShape baseShape)
 538                    {
 0539                        baseShape.DetachFrom(entity);
 540                    }
 541
 0542                    return;
 543
 544                case ComponentNameLiterals.OnClick:
 545                    {
 1546                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.UUID_ON_CLICK, out IEntityComponent component
 547                        {
 1548                            Utils.SafeDestroy(component.GetTransform().gameObject);
 1549                            RemoveComponent(entity, CLASS_ID_COMPONENT.UUID_ON_CLICK);
 550                        }
 551
 1552                        return;
 553                    }
 554                case ComponentNameLiterals.OnPointerDown:
 555                    {
 1556                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.UUID_ON_DOWN, out IEntityComponent component)
 557                        {
 1558                            Utils.SafeDestroy(component.GetTransform().gameObject);
 1559                            RemoveComponent(entity, CLASS_ID_COMPONENT.UUID_ON_DOWN);
 560                        }
 561                    }
 1562                    return;
 563                case ComponentNameLiterals.OnPointerUp:
 564                    {
 1565                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.UUID_ON_UP, out IEntityComponent component))
 566                        {
 1567                            Utils.SafeDestroy(component.GetTransform().gameObject);
 1568                            RemoveComponent(entity, CLASS_ID_COMPONENT.UUID_ON_UP);
 569                        }
 570                    }
 1571                    return;
 572                case ComponentNameLiterals.OnPointerHoverEnter:
 573                    {
 2574                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.UUID_ON_HOVER_ENTER, out IEntityComponent com
 575                        {
 2576                            Utils.SafeDestroy(component.GetTransform().gameObject);
 2577                            RemoveComponent(entity, CLASS_ID_COMPONENT.UUID_ON_HOVER_ENTER);
 578                        }
 579                    }
 2580                    return;
 581                case ComponentNameLiterals.OnPointerHoverExit:
 582                    {
 2583                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.UUID_ON_HOVER_EXIT, out IEntityComponent comp
 584                        {
 2585                            Utils.SafeDestroy(component.GetTransform().gameObject);
 2586                            RemoveComponent(entity, CLASS_ID_COMPONENT.UUID_ON_HOVER_EXIT);
 587                        }
 588                    }
 2589                    return;
 590                case "transform":
 591                    {
 0592                        if (TryGetBaseComponent(entity, CLASS_ID_COMPONENT.AVATAR_ATTACH, out IEntityComponent component
 593                        {
 0594                            component.Cleanup();
 0595                            RemoveComponent(entity, CLASS_ID_COMPONENT.AVATAR_ATTACH);
 596                        }
 597                    }
 0598                    return;
 599
 600                default:
 601                    {
 75602                        IEntityComponent component = GetComponentsDictionary(entity).FirstOrDefault(kp => kp.Value.compo
 30603                        if (component == null)
 604                            break;
 605
 15606                        RemoveComponent(entity, (CLASS_ID_COMPONENT)component.GetClassId());
 607
 15608                        if (component is ICleanable cleanableComponent)
 15609                            cleanableComponent.Cleanup();
 610
 15611                        bool released = false;
 15612                        if (component is IPoolableObjectContainer poolableContainer)
 613                        {
 13614                            if (poolableContainer.poolableObject != null)
 615                            {
 1616                                poolableContainer.poolableObject.Release();
 1617                                released = true;
 618                            }
 619                        }
 15620                        if (!released)
 621                        {
 14622                            Utils.SafeDestroy(component.GetTransform()?.gameObject);
 623                        }
 624                        break;
 625                    }
 626            }
 30627        }
 628
 629        public void DisposeAllSceneComponents()
 630        {
 729631            List<string> allDisposableComponents = disposableComponents.Select(x => x.Key).ToList();
 1458632            foreach (string id in allDisposableComponents)
 633            {
 421634                parcelScenesCleaner.MarkDisposableComponentForCleanup(scene, id);
 635            }
 308636        }
 637    }
 638}

Methods/Properties

ECSComponentsManagerLegacy(DCL.Controllers.IParcelScene, DCL.IRuntimeComponentFactory, DCL.IParcelScenesCleaner, DCL.Controllers.ISceneBoundsChecker, DCL.IPhysicsSyncController, DCL.Rendering.ICullingController, FeatureFlag)
ECSComponentsManagerLegacy(DCL.Controllers.IParcelScene)
AddSharedComponent(DCL.Models.IDCLEntity, System.Type, DCL.Components.ISharedComponent)
RemoveSharedComponent(DCL.Models.IDCLEntity, System.Type, System.Boolean)
TryGetComponent[T](DCL.Models.IDCLEntity)
TryGetBaseComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT, DCL.Components.IEntityComponent&)
TryGetSharedComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID, DCL.Components.ISharedComponent&)
GetSharedComponent(DCL.Models.IDCLEntity, System.Type)
HasComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT)
HasSharedComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID)
RemoveComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT)
AddComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT, DCL.Components.IEntityComponent)
GetComponent(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT)
GetComponents()
GetSharedComponents()
GetComponentsDictionary(DCL.Models.IDCLEntity)
GetSharedComponentsDictionary(DCL.Models.IDCLEntity)
GetComponentsCount()
CleanComponents(DCL.Models.IDCLEntity)
HasSceneSharedComponent(System.String)
GetSceneSharedComponent(System.String)
TryGetSceneSharedComponent(System.String, DCL.Components.ISharedComponent&)
GetSceneSharedComponentsDictionary()
GetSceneSharedComponentsCount()
AddSceneSharedComponent(System.String, DCL.Components.ISharedComponent)
RemoveSceneSharedComponent(System.String)
SceneSharedComponentCreate(System.String, System.Int32)
GetSceneSharedComponent[T]()
SceneSharedComponentAttach(System.Int64, System.String)
EntityComponentCreateOrUpdate(System.Int64, DCL.Models.CLASS_ID_COMPONENT, System.Object)
EntityComponentUpdate(DCL.Models.IDCLEntity, DCL.Models.CLASS_ID_COMPONENT, System.String)
SceneSharedComponentDispose(System.String)
SceneSharedComponentUpdate(System.String, BaseModel)
SceneSharedComponentUpdate(System.String, System.String)
EntityComponentRemove(System.Int64, System.String)
DisposeAllSceneComponents()