| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEditor; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace DCL.Skybox |
| | 8 | | { |
| | 9 | | public static class RenderSimpleValues |
| | 10 | | { |
| | 11 | | public static void RenderSepratedFloatFields(string label, string label1, ref float value1, string label2, ref f |
| | 12 | | { |
| 0 | 13 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 14 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 15 | | EditorGUILayout.LabelField(label1, GUILayout.Width(90), GUILayout.ExpandWidth(false)); |
| 0 | 16 | | value1 = EditorGUILayout.FloatField("", value1, GUILayout.Width(90)); |
| 0 | 17 | | EditorGUILayout.LabelField(label2, GUILayout.Width(90), GUILayout.ExpandWidth(false)); |
| 0 | 18 | | value2 = EditorGUILayout.FloatField("", value2, GUILayout.Width(90)); |
| 0 | 19 | | GUILayout.EndHorizontal(); |
| 0 | 20 | | EditorGUILayout.Separator(); |
| 0 | 21 | | } |
| | 22 | |
|
| | 23 | | public static void RenderFloatField(string label, ref float value) |
| | 24 | | { |
| 0 | 25 | | EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 26 | | value = EditorGUILayout.FloatField(label, value, GUILayout.Width(200)); |
| 0 | 27 | | EditorGUILayout.EndHorizontal(); |
| 0 | 28 | | EditorGUILayout.Separator(); |
| 0 | 29 | | } |
| | 30 | |
|
| | 31 | | public static void RenderFloatFieldAsSlider(string label, ref float value, float min, float max) |
| | 32 | | { |
| 0 | 33 | | EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 34 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 35 | | value = EditorGUILayout.Slider(value, min, max, GUILayout.Width(200)); |
| 0 | 36 | | EditorGUILayout.EndHorizontal(); |
| 0 | 37 | | EditorGUILayout.Separator(); |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | internal static void RenderMinMaxSlider(string label, ref float minVal, ref float maxVal, float minLimit, float |
| | 41 | | { |
| 0 | 42 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 43 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 44 | | EditorGUILayout.LabelField(minVal.ToString("f3"), GUILayout.Width(55), GUILayout.ExpandWidth(false)); |
| 0 | 45 | | EditorGUILayout.MinMaxSlider(ref minVal, ref maxVal, minLimit, maxLimit, GUILayout.Width(150)); |
| 0 | 46 | | EditorGUILayout.LabelField(maxVal.ToString("f3"), GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 47 | | GUILayout.EndHorizontal(); |
| 0 | 48 | | EditorGUILayout.Separator(); |
| 0 | 49 | | } |
| | 50 | |
|
| | 51 | | public static void RenderVector3Field(string label, ref Vector3 value) |
| | 52 | | { |
| 0 | 53 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 54 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 55 | | value = EditorGUILayout.Vector3Field("", value, GUILayout.Width(200), GUILayout.ExpandWidth(false)); |
| 0 | 56 | | GUILayout.EndHorizontal(); |
| 0 | 57 | | EditorGUILayout.Separator(); |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | public static void RenderVector2Field(string label, ref Vector2 value) |
| | 61 | | { |
| 0 | 62 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 63 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 64 | | value = EditorGUILayout.Vector2Field("", value, GUILayout.Width(200), GUILayout.ExpandWidth(false)); |
| 0 | 65 | | GUILayout.EndHorizontal(); |
| 0 | 66 | | EditorGUILayout.Separator(); |
| 0 | 67 | | } |
| | 68 | |
|
| | 69 | | public static void RenderTexture(string label, ref Texture2D tex) |
| | 70 | | { |
| 0 | 71 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 72 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 73 | | tex = (Texture2D)EditorGUILayout.ObjectField(tex, typeof(Texture2D), false, GUILayout.Width(200)); |
| 0 | 74 | | GUILayout.EndHorizontal(); |
| 0 | 75 | | EditorGUILayout.Separator(); |
| 0 | 76 | | } |
| | 77 | |
|
| | 78 | | public static void RenderCubemapTexture(string label, ref Cubemap tex) |
| | 79 | | { |
| 0 | 80 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 81 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 82 | | tex = (Cubemap)EditorGUILayout.ObjectField(tex, typeof(Cubemap), false, GUILayout.Width(200)); |
| 0 | 83 | | GUILayout.EndHorizontal(); |
| 0 | 84 | | EditorGUILayout.Separator(); |
| 0 | 85 | | } |
| | 86 | |
|
| | 87 | | public static void RenderColorGradientField(Gradient color, string label = SkyboxEditorLiterals.LayerProperties. |
| | 88 | | { |
| 0 | 89 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 90 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| | 91 | |
|
| 0 | 92 | | if (startTime != -1) |
| | 93 | | { |
| 0 | 94 | | EditorGUILayout.LabelField(startTime + SkyboxEditorLiterals.short_Hour, GUILayout.Width(65), GUILayout.E |
| | 95 | | } |
| | 96 | |
|
| 0 | 97 | | color = EditorGUILayout.GradientField(new GUIContent(""), color, hdr, GUILayout.Width(250), GUILayout.Expand |
| | 98 | |
|
| 0 | 99 | | if (endTime != 1) |
| | 100 | | { |
| 0 | 101 | | EditorGUILayout.LabelField(endTime + SkyboxEditorLiterals.short_Hour, GUILayout.Width(65), GUILayout.Exp |
| | 102 | | } |
| 0 | 103 | | GUILayout.EndHorizontal(); |
| 0 | 104 | | EditorGUILayout.Separator(); |
| 0 | 105 | | } |
| | 106 | |
|
| | 107 | | public static void RenderPrefabInput(string label, ref GameObject obj) |
| | 108 | | { |
| 0 | 109 | | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 110 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 111 | | obj = (GameObject)EditorGUILayout.ObjectField(obj, typeof(GameObject), false, GUILayout.Width(200)); |
| 0 | 112 | | GUILayout.EndHorizontal(); |
| 0 | 113 | | EditorGUILayout.Separator(); |
| 0 | 114 | | } |
| | 115 | |
|
| | 116 | | public static void RenderEnumPopup<T>(string label, ref T enumVar) where T : System.Enum |
| | 117 | | { |
| | 118 | | // Layer Type |
| 0 | 119 | | EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 120 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 121 | | enumVar = (T)EditorGUILayout.EnumPopup(enumVar, GUILayout.Width(200)); |
| 0 | 122 | | EditorGUILayout.EndHorizontal(); |
| 0 | 123 | | EditorGUILayout.Separator(); |
| 0 | 124 | | } |
| | 125 | |
|
| | 126 | | public static void RenderBoolField(string label, ref bool value) |
| | 127 | | { |
| 0 | 128 | | EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); |
| 0 | 129 | | EditorGUILayout.LabelField(label, GUILayout.Width(150), GUILayout.ExpandWidth(false)); |
| 0 | 130 | | value = EditorGUILayout.Toggle(value, GUILayout.Width(90)); |
| 0 | 131 | | EditorGUILayout.EndHorizontal(); |
| 0 | 132 | | EditorGUILayout.Separator(); |
| 0 | 133 | | } |
| | 134 | | } |
| | 135 | | } |