< Summary

Class:DCL.ECSComponents.OnPointerUp.OnPointerUpComponentHandler
Assembly:DCL.ECSComponents.OnPointerUp
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Events/OnPointerUp/Handler/OnPointerUpComponentHandler.cs
Covered lines:13
Uncovered lines:5
Coverable lines:18
Total lines:51
Line coverage:72.2% (13 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnPointerUpComponentHandler(...)0%110100%
OnComponentCreated(...)0%2.032080%
OnComponentRemoved(...)0%6200%
OnComponentModelUpdated(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Events/OnPointerUp/Handler/OnPointerUpComponentHandler.cs

#LineLine coverage
 1using DCL;
 2using DCL.Controllers;
 3using DCL.ECSComponents;
 4using DCL.ECSRuntime;
 5using DCL.Models;
 6using DCLPlugins.ECSComponents;
 7using DCLPlugins.UUIDEventComponentsPlugin.UUIDComponent.Interfaces;
 8
 9namespace DCL.ECSComponents.OnPointerUp
 10{
 11    public class OnPointerUpComponentHandler : IECSComponentHandler<PBOnPointerUp>
 12    {
 13        private PointerInputRepresentantion representantion;
 14        private IECSComponentWriter componentWriter;
 15        private DataStore_ECS7 dataStore;
 16
 17        private bool isAdded = false;
 18
 419        public OnPointerUpComponentHandler(IECSComponentWriter componentWriter, DataStore_ECS7 dataStore)
 20        {
 421            this.dataStore = dataStore;
 422            this.componentWriter = componentWriter;
 423        }
 24
 25        public void OnComponentCreated(IParcelScene scene, IDCLEntity entity)
 26        {
 427            if(representantion != null)
 028                representantion.Dispose();
 29
 430            representantion = new PointerInputRepresentantion(entity, dataStore, PointerInputEventType.UP, componentWrit
 431            isAdded = false;
 432        }
 33
 34        public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 35        {
 036            representantion?.Dispose();
 037            dataStore.RemovePointerEvent(entity.entityId,representantion);
 038            isAdded = false;
 039        }
 40
 41        public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, PBOnPointerUp model)
 42        {
 443            representantion.SetData(scene, entity, model.GetShowFeedback(), model.GetButton(), model.GetMaxDistance(), m
 444            if (!isAdded)
 45            {
 446                isAdded = true;
 447                dataStore.AddPointerEvent(entity.entityId, representantion);
 48            }
 449        }
 50    }
 51}