< Summary

Class:DCL.Builder.EntityComponentsUtils
Assembly:BIWEntityComponentUtils
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/Utils/EntityComponentUtils/EntityComponentsUtils.cs
Covered lines:24
Uncovered lines:1
Coverable lines:25
Total lines:66
Line coverage:96% (24 of 25)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AddTransformComponent(...)0%110100%
AddNFTShapeComponent(...)0%110100%
AddGLTFComponent(...)0%110100%
AddNameComponent(...)0%110100%
AddLockedOnEditComponent(...)0%110100%
EnsureId(...)0%2.152066.67%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/Utils/EntityComponentUtils/EntityComponentsUtils.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using DCL.Components;
 5using DCL.Controllers;
 6using DCL.Models;
 7using UnityEditor;
 8using UnityEngine;
 9
 10namespace DCL.Builder
 11{
 12    public static class EntityComponentsUtils
 13    {
 14        public static void AddTransformComponent(IParcelScene scene, IDCLEntity entity, DCLTransform.Model model)
 15        {
 3116            scene.EntityComponentCreateOrUpdateWithModel(entity.entityId, CLASS_ID_COMPONENT.TRANSFORM, model);
 3117        }
 18
 19        public static NFTShape AddNFTShapeComponent(IParcelScene scene, IDCLEntity entity, NFTShape.Model model, string 
 20        {
 121            id = EnsureId(id);
 22
 123            NFTShape nftShape = (NFTShape) scene.SharedComponentCreate(id, Convert.ToInt32(CLASS_ID.NFT_SHAPE));
 124            nftShape.model = model;
 125            scene.SharedComponentAttach(entity.entityId, nftShape.id);
 126            return nftShape;
 27        }
 28
 29        public static GLTFShape AddGLTFComponent(IParcelScene scene, IDCLEntity entity, GLTFShape.Model model, string id
 30        {
 1531            id = EnsureId(id);
 32
 1533            GLTFShape gltfComponent = (GLTFShape) scene.SharedComponentCreate(id, Convert.ToInt32(CLASS_ID.GLTF_SHAPE));
 1534            gltfComponent.model = model;
 1535            scene.SharedComponentAttach(entity.entityId, gltfComponent.id);
 1536            return gltfComponent;
 37        }
 38
 39        public static DCLName AddNameComponent(IParcelScene scene, IDCLEntity entity, DCLName.Model model, string id = "
 40        {
 1941            id = EnsureId(id);
 42
 1943            DCLName name = (DCLName) scene.SharedComponentCreate(id, Convert.ToInt32(CLASS_ID.NAME));
 1944            name.UpdateFromModel(model);
 1945            scene.SharedComponentAttach(entity.entityId, name.id);
 1946            return name;
 47        }
 48
 49        public static DCLLockedOnEdit AddLockedOnEditComponent(IParcelScene scene, IDCLEntity entity, DCLLockedOnEdit.Mo
 50        {
 5051            id = EnsureId(id);
 52
 5053            DCLLockedOnEdit lockedOnEditComponent = (DCLLockedOnEdit) scene.SharedComponentCreate(id, Convert.ToInt32(CL
 5054            lockedOnEditComponent.UpdateFromModel(model);
 5055            scene.SharedComponentAttach(entity.entityId, lockedOnEditComponent.id);
 5056            return lockedOnEditComponent;
 57        }
 58
 59        private static string EnsureId(string currentId)
 60        {
 8561            if (string.IsNullOrEmpty(currentId))
 062                return Guid.NewGuid().ToString();
 8563            return currentId;
 64        }
 65    }
 66}