< Summary

Class:InternalECSComponents
Assembly:ECS7Plugin.InternalECSComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/InternalECSComponents.cs
Covered lines:42
Uncovered lines:1
Coverable lines:43
Total lines:106
Line coverage:97.6% (42 of 43)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
InternalECSComponents(...)0%110100%
Dispose()0%110100%
WriteSystemUpdate()0%440100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/InternalECSComponents.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using DCL.ECS7.InternalComponents;
 4using DCL.ECSRuntime;
 5
 6public class InternalECSComponents : IDisposable, IInternalECSComponents
 7{
 508    internal readonly IList<InternalComponentWriteData> scheduledWrite = new List<InternalComponentWriteData>(50);
 9
 110    public IInternalECSComponent<InternalTexturizable> texturizableComponent { get; }
 111    public IInternalECSComponent<InternalMaterial> materialComponent { get; }
 112    public IInternalECSComponent<InternalColliders> onPointerColliderComponent { get; }
 013    public IInternalECSComponent<InternalColliders> physicColliderComponent { get; }
 214    public IInternalECSComponent<InternalInputEventResults> inputEventResultsComponent { get; }
 115    public IInternalECSComponent<InternalRenderers> renderersComponent { get; }
 116    public IInternalECSComponent<InternalVisibility> visibilityComponent { get; }
 17
 5018    public InternalECSComponents(ECSComponentsManager componentsManager, ECSComponentsFactory componentsFactory)
 19    {
 5020        texturizableComponent = new InternalECSComponent<InternalTexturizable>(
 21            InternalECSComponentsId.TEXTURIZABLE,
 22            componentsManager,
 23            componentsFactory,
 1324            () => new RemoveOnConditionHandler<InternalTexturizable>(
 3325                () => texturizableComponent, model => model.renderers.Count == 0),
 26            scheduledWrite);
 27
 5028        materialComponent = new InternalECSComponent<InternalMaterial>(
 29            InternalECSComponentsId.MATERIAL,
 30            componentsManager,
 31            componentsFactory,
 32            null,
 33            scheduledWrite);
 34
 5035        onPointerColliderComponent = new InternalECSComponent<InternalColliders>(
 36            InternalECSComponentsId.COLLIDER_POINTER,
 37            componentsManager,
 38            componentsFactory,
 4739            () => new RemoveOnConditionHandler<InternalColliders>(
 10940                () => onPointerColliderComponent, model => model.colliders.Count == 0),
 41            scheduledWrite);
 42
 5043        physicColliderComponent = new InternalECSComponent<InternalColliders>(
 44            InternalECSComponentsId.COLLIDER_PHYSICAL,
 45            componentsManager,
 46            componentsFactory,
 2247            () => new RemoveOnConditionHandler<InternalColliders>(
 4448                () => physicColliderComponent, model => model.colliders.Count == 0),
 49            scheduledWrite);
 50
 5051        renderersComponent = new InternalECSComponent<InternalRenderers>(
 52            InternalECSComponentsId.RENDERERS,
 53            componentsManager,
 54            componentsFactory,
 2255            () => new RemoveOnConditionHandler<InternalRenderers>(
 7456                () => renderersComponent, model => model.renderers.Count == 0),
 57            scheduledWrite);
 58
 5059        visibilityComponent = new InternalECSComponent<InternalVisibility>(
 60            InternalECSComponentsId.VISIBILITY,
 61            componentsManager,
 62            componentsFactory,
 63            null,
 64            scheduledWrite);
 65
 5066        inputEventResultsComponent = new InternalECSComponent<InternalInputEventResults>(
 67            InternalECSComponentsId.INPUT_EVENTS_RESULT,
 68            componentsManager,
 69            componentsFactory,
 70            null,
 71            scheduledWrite);
 5072    }
 73
 74    public void Dispose()
 75    {
 176        scheduledWrite.Clear();
 77
 178        texturizableComponent.Dispose();
 179        materialComponent.Dispose();
 180        onPointerColliderComponent.Dispose();
 181        physicColliderComponent.Dispose();
 182        renderersComponent.Dispose();
 183        inputEventResultsComponent.Dispose();
 184    }
 85
 86    public void WriteSystemUpdate()
 87    {
 11488        for (int i = 0; i < scheduledWrite.Count; i++)
 89        {
 4090            var writeData = scheduledWrite[i];
 4091            if (writeData.scene == null)
 92                continue;
 93
 4094            InternalComponent data = writeData.data;
 4095            if (data != null)
 96            {
 3897                data._dirty = false;
 3898            }
 99            else
 100            {
 2101                writeData.scene.crdtExecutor.ExecuteWithoutStoringState(writeData.entityId, writeData.componentId, null)
 102            }
 103        }
 17104        scheduledWrite.Clear();
 17105    }
 106}