< Summary

Class:DCL.Builder.SceneData
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/ScenesController/SceneData.cs
Covered lines:39
Uncovered lines:18
Coverable lines:57
Total lines:134
Line coverage:68.4% (39 of 57)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
get_coords()0%110100%
get_size()0%110100%
get_id()0%110100%
get_name()0%110100%
get_thumbnailUrl()0%110100%
get_isOwner()0%110100%
get_isOperator()0%110100%
get_isContributor()0%110100%
get_isDeployed()0%110100%
get_entitiesCount()0%110100%
get_authorThumbnail()0%110100%
get_authorName()0%110100%
get_requiredPermissions()0%110100%
get_isMatureContent()0%110100%
get_allowVoiceChat()0%110100%
get_description()0%110100%
get_contributors()0%2100%
get_admins()0%2100%
get_bannedUsers()0%2100%
get_isEditable()0%110100%
get_parcels()0%110100%
get_projectId()0%2100%
get_isEmpty()0%2100%
get_source()0%2100%
SceneData()0%2100%
SceneData(...)0%9.747061.76%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/ScenesController/SceneData.cs

#LineLine coverage
 1using System;
 2using DCL.Builder;
 3using UnityEngine;
 4
 5namespace DCL.Builder
 6{
 7    internal interface ISceneData
 8    {
 9        Vector2Int coords { get; }
 10        Vector2Int size { get; }
 11        string id { get; }
 12        string name { get; }
 13        string thumbnailUrl { get; }
 14        bool isOwner { get; }
 15        bool isOperator { get; }
 16        bool isContributor { get; }
 17        bool isDeployed { get; }
 18        int entitiesCount { get; }
 19        string authorThumbnail { get; }
 20        string authorName { get; }
 21        string[] requiredPermissions { get; }
 22        bool isMatureContent { get; }
 23        bool allowVoiceChat { get; }
 24        string description { get; }
 25        string[] contributors { get; }
 26        string[] admins { get;  }
 27        string[] bannedUsers { get;  }
 28        bool isEditable { get; }
 29        Vector2Int[] parcels { get; }
 30        string projectId { get; }
 31        bool isEmpty { get; }
 32        Scene.Source source { get; }
 33    }
 34
 35    [Serializable]
 36    internal class SceneData : ISceneData
 37    {
 38        public Vector2Int coords;
 39        public Vector2Int size;
 40        public string id;
 41        public string name;
 42        public string thumbnailUrl;
 43        public bool isOwner;
 44        public bool isOperator;
 45        public bool isContributor;
 46        public bool isDeployed;
 47        public int entitiesCount;
 48        public string authorThumbnail;
 49        public string authorName;
 50        public string[] requiredPermissions;
 51        public bool isMatureContent;
 52        public bool allowVoiceChat;
 53        public string description;
 54        public string[] contributors;
 55        public string[] admins;
 56        public string[] bannedUsers;
 57        public bool isEditable;
 58        public Vector2Int[] parcels;
 59        public string projectId;
 60        public bool isEmpty;
 61        public Scene.Source source;
 62
 2963        Vector2Int ISceneData.coords => coords;
 6564        Vector2Int ISceneData.size => size;
 8565        string ISceneData.id => id;
 2866        string ISceneData.name => name;
 2767        string ISceneData.thumbnailUrl => thumbnailUrl;
 2568        bool ISceneData.isOwner => isOwner;
 2569        bool ISceneData.isOperator => isOperator;
 2570        bool ISceneData.isContributor => isContributor;
 8571        bool ISceneData.isDeployed => isDeployed;
 272        int ISceneData.entitiesCount => entitiesCount;
 273        string ISceneData.authorThumbnail => authorThumbnail;
 274        string ISceneData.authorName => authorName;
 675        string[] ISceneData.requiredPermissions => requiredPermissions;
 276        bool ISceneData.isMatureContent => isMatureContent;
 277        bool ISceneData.allowVoiceChat => allowVoiceChat;
 378        string ISceneData.description => description;
 079        string[] ISceneData.contributors => contributors;
 080        string[] ISceneData.admins => admins;
 081        string[] ISceneData.bannedUsers => bannedUsers;
 2582        bool ISceneData.isEditable => isEditable;
 2583        Vector2Int[] ISceneData.parcels => parcels;
 084        string ISceneData.projectId => projectId;
 085        bool ISceneData.isEmpty => isEmpty;
 086        Scene.Source ISceneData.source => source;
 87
 088        public SceneData() { }
 89
 190        public SceneData(Scene scene)
 91        {
 192            coords = scene.@base;
 193            id = scene.id;
 194            name = scene.title;
 195            description = scene.description;
 196            thumbnailUrl = scene.navmapThumbnail;
 197            isOwner = scene?.land?.role == LandRole.OWNER;
 198            isOperator = !isOwner;
 199            isContributor = false;
 1100            isDeployed = true;
 1101            authorName = scene.author;
 1102            requiredPermissions = scene.requiredPermissions;
 1103            isEditable = scene.source != Scene.Source.SDK;
 1104            parcels = scene.parcels;
 1105            projectId = scene.projectId;
 1106            isEmpty = scene.isEmpty;
 1107            source = scene.source;
 108
 1109            isMatureContent = false;
 110
 1111            if (scene.parcels.Length < 2)
 112            {
 1113                size = new Vector2Int(1, 1);
 1114            }
 115            else
 116            {
 0117                int minX = scene.parcels[0].x;
 0118                int maxX = scene.parcels[0].x;
 0119                int minY = scene.parcels[0].y;
 0120                int maxY = scene.parcels[0].y;
 121
 0122                for (int i = 1; i < scene.parcels.Length; i++)
 123                {
 0124                    minX = Mathf.Min(minX, scene.parcels[i].x);
 0125                    minY = Mathf.Min(minY, scene.parcels[i].y);
 0126                    maxX = Mathf.Max(maxX, scene.parcels[i].x);
 0127                    maxY = Mathf.Max(maxY, scene.parcels[i].y);
 128                }
 129
 0130                size = new Vector2Int(Mathf.Abs(maxX - minX), Mathf.Abs(maxY - minY));
 131            }
 0132        }
 133    }
 134}