< Summary

Class:DCL.Skybox.EditorToolMeasurements
Assembly:SkyboxEditorAssembly
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/Editor/Procedural Skybox/EditorToolMeasurements.cs
Covered lines:0
Uncovered lines:22
Coverable lines:22
Total lines:82
Line coverage:0% (0 of 22)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
EditorToolMeasurements()0%2100%
OnValidate()0%2100%
AssignValues()0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/Editor/Procedural Skybox/EditorToolMeasurements.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEditor;
 4using UnityEngine;
 5
 6namespace DCL.Skybox
 7{
 8    [CreateAssetMenu(fileName = "EditorToolSize", menuName = "ScriptableObjects/SkyboxEditorSize", order = 1)]
 9    public class EditorToolMeasurements : ScriptableObject
 10    {
 11        public GUIStyle testStyle;
 012        public float topPanelTopStart = 5;
 013        public float topPanelLeftStart = 5;
 014        public float toolRightPadding = 5;
 015        public float topPanelHeight = 200;
 016        public Color panelBGColor = Color.grey;
 017        public float panelsPadding = 10;
 18        [Range(0.0f, 1f)]
 019        public float leftPanelWidthPercentage = 0.25f;
 20
 21        // Left Panel
 22        public Rect leftPanelPadding;
 23        public float leftPanelButtonSpace;
 024        public float layerButtonWidth = 50;
 025        public float layerRenderWidth = 20;
 026        public float layerActiveCheckboxSize = 15;
 27        public GUIStyle leftPanelHorizontal;
 28
 29        // Right Panel
 30        [Header("Right Panel")]
 031        public float pinnedPanelHeight = 300;
 32        public Rect pinnedPanelBGOffset;
 33        public Rect rightPanelPadding;
 34        public GUIStyleStateVar rightPanelHeadingState;
 35        public GUIStyleStateVar rightPanelHeadingTextColor;
 36        public GUIStyleStateVar transitioningVariableBG;
 37
 38        private void OnValidate()
 39        {
 40            // Make new texture and assign to specific style state
 041            rightPanelHeadingState.AssignTexture();
 042            rightPanelHeadingTextColor.AssignTexture();
 043            transitioningVariableBG.AssignTexture();
 044        }
 45
 46        [ContextMenu("Assign Values")]
 47        public void AssignValues()
 48        {
 049            Texture2D newTex = new Texture2D(28, 28);
 050            for (int i = 0; i < newTex.height; i++)
 51            {
 052                for (int j = 0; j < newTex.width; j++)
 53                {
 054                    newTex.SetPixel(i, j, Color.blue);
 55                }
 56            }
 057            newTex.Apply();
 058            leftPanelHorizontal.hover.background = newTex;
 059        }
 60    }
 61
 62    [System.Serializable]
 63    public class GUIStyleStateVar
 64    {
 65        public Color backgroundColor;
 66        public Color textColor = Color.white;
 67        [SerializeField] public Texture2D backgroundTex;
 68
 69        public void AssignTexture()
 70        {
 71            backgroundTex = new Texture2D(28, 28);
 72            for (int i = 0; i < backgroundTex.height; i++)
 73            {
 74                for (int j = 0; j < backgroundTex.width; j++)
 75                {
 76                    backgroundTex.SetPixel(i, j, backgroundColor);
 77                }
 78            }
 79            backgroundTex.Apply();
 80        }
 81    }
 82}