| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using UnityEditor; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace 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; |
| 0 | 66 | | public Color textColor = Color.white; |
| | 67 | | [SerializeField] public Texture2D backgroundTex; |
| | 68 | |
|
| | 69 | | public void AssignTexture() |
| | 70 | | { |
| 0 | 71 | | backgroundTex = new Texture2D(28, 28); |
| 0 | 72 | | for (int i = 0; i < backgroundTex.height; i++) |
| | 73 | | { |
| 0 | 74 | | for (int j = 0; j < backgroundTex.width; j++) |
| | 75 | | { |
| 0 | 76 | | backgroundTex.SetPixel(i, j, backgroundColor); |
| | 77 | | } |
| | 78 | | } |
| 0 | 79 | | backgroundTex.Apply(); |
| 0 | 80 | | } |
| | 81 | | } |
| | 82 | | } |