< Summary

Class:DCL.ECSComponents.NFTShapeFrameFactory
Assembly:DCL.ECSComponents.NFTShape
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/NFTShape/NFTShapeFrameFactory.cs
Covered lines:2
Uncovered lines:2
Coverable lines:4
Total lines:41
Line coverage:50% (2 of 4)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
InstantiateLoaderController(...)0%3.333066.67%
InstantiateErrorFeedback(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/NFTShape/NFTShapeFrameFactory.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL.ECSComponents
 4{
 5    public interface INFTShapeFrameFactory
 6    {
 7        /// <summary>
 8        /// Return the instance of a NFT shape frame based on the index
 9        /// </summary>
 10        /// <param name="index"></param>
 11        /// <returns></returns>
 12        NFTShapeFrame InstantiateLoaderController(int index);
 13
 14        /// <summary>
 15        /// This will instantiate an error feedback and it will be attached to gameObject as a child
 16        /// </summary>
 17        /// <param name="gameObjectToAttach"></param>
 18        /// <returns></returns>
 19        GameObject InstantiateErrorFeedback(GameObject gameObjectToAttach);
 20    }
 21
 22    public class NFTShapeFrameFactory : ScriptableObject, INFTShapeFrameFactory
 23    {
 24        [SerializeField] internal NFTShapeFrame[] loaderControllersPrefabs;
 25        [SerializeField] private NFTShapeFrame defaultFramePrefabs;
 26        [SerializeField] private GameObject errorFeedback;
 27
 28        public NFTShapeFrame InstantiateLoaderController(int index)
 29        {
 3030            if (index >= 0 && index < loaderControllersPrefabs.Length)
 3031                return Instantiate(loaderControllersPrefabs[index]);
 32
 033            return Instantiate(defaultFramePrefabs);
 34        }
 35
 36        public GameObject InstantiateErrorFeedback(GameObject gameObjectToAttach)
 37        {
 038            return Instantiate(errorFeedback,gameObjectToAttach.transform);
 39        }
 40    }
 41}