< Summary

Class:DCL.Skybox.GUIStyleStateVar
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:7
Coverable lines:7
Total lines:82
Line coverage:0% (0 of 7)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GUIStyleStateVar()0%2100%
AssignTexture()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;
 12        public float topPanelTopStart = 5;
 13        public float topPanelLeftStart = 5;
 14        public float toolRightPadding = 5;
 15        public float topPanelHeight = 200;
 16        public Color panelBGColor = Color.grey;
 17        public float panelsPadding = 10;
 18        [Range(0.0f, 1f)]
 19        public float leftPanelWidthPercentage = 0.25f;
 20
 21        // Left Panel
 22        public Rect leftPanelPadding;
 23        public float leftPanelButtonSpace;
 24        public float layerButtonWidth = 50;
 25        public float layerRenderWidth = 20;
 26        public float layerActiveCheckboxSize = 15;
 27        public GUIStyle leftPanelHorizontal;
 28
 29        // Right Panel
 30        [Header("Right Panel")]
 31        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
 41            rightPanelHeadingState.AssignTexture();
 42            rightPanelHeadingTextColor.AssignTexture();
 43            transitioningVariableBG.AssignTexture();
 44        }
 45
 46        [ContextMenu("Assign Values")]
 47        public void AssignValues()
 48        {
 49            Texture2D newTex = new Texture2D(28, 28);
 50            for (int i = 0; i < newTex.height; i++)
 51            {
 52                for (int j = 0; j < newTex.width; j++)
 53                {
 54                    newTex.SetPixel(i, j, Color.blue);
 55                }
 56            }
 57            newTex.Apply();
 58            leftPanelHorizontal.hover.background = newTex;
 59        }
 60    }
 61
 62    [System.Serializable]
 63    public class GUIStyleStateVar
 64    {
 65        public Color backgroundColor;
 066        public Color textColor = Color.white;
 67        [SerializeField] public Texture2D backgroundTex;
 68
 69        public void AssignTexture()
 70        {
 071            backgroundTex = new Texture2D(28, 28);
 072            for (int i = 0; i < backgroundTex.height; i++)
 73            {
 074                for (int j = 0; j < backgroundTex.width; j++)
 75                {
 076                    backgroundTex.SetPixel(i, j, backgroundColor);
 77                }
 78            }
 079            backgroundTex.Apply();
 080        }
 81    }
 82}

Methods/Properties

GUIStyleStateVar()
AssignTexture()