7
7
[ CustomEditor ( typeof ( ScriptablePalette ) ) ]
8
8
public class ScriptablePaletteEditor : Editor
9
9
{
10
- private const int NUM_COLORS_MIN = 3 ;
11
- private const int NUM_COLORS_MAX = 10 ;
10
+ private const int _NUM_COLORS_MIN = 3 ;
11
+ private const int _NUM_COLORS_MAX = 10 ;
12
12
13
- private const float HELPER_TEXT_COLOR_VAL = 0.7f ;
13
+ private const float _HELPER_TEXT_COLOR_VAL = 0.7f ;
14
14
15
- private const string COLOR_FIELD_PREFIX = "Color {0}" ;
15
+ private const string _COLOR_FIELD_PREFIX = "Color {0}" ;
16
16
17
- private const string KEY_COLOR_INFO = "Color used as a seed for generating the color palette" ;
18
- private const string NUM_COLOR_INFO = "Number of colors to generate in the palette" ;
17
+ private const string _KEY_COLOR_INFO = "Color used as a seed for generating the color palette" ;
18
+ private const string _NUM_COLOR_INFO = "Number of colors to generate in the palette" ;
19
19
20
- private const string HUE_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color hue" ;
21
- private const string SAT_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color saturation" ;
22
- private const string VAL_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color value" ;
20
+ private const string _HUE_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color hue" ;
21
+ private const string _SAT_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color saturation" ;
22
+ private const string _VAL_RANGE_INFO = "Maximum range that randomly generated colors will deviate from the key color value" ;
23
23
24
24
override public void OnInspectorGUI ( )
25
25
{
@@ -29,7 +29,7 @@ override public void OnInspectorGUI()
29
29
30
30
GUIStyle wrapTextStyle = new GUIStyle ( ) ;
31
31
wrapTextStyle . wordWrap = true ;
32
- wrapTextStyle . normal . textColor = new Color ( HELPER_TEXT_COLOR_VAL , HELPER_TEXT_COLOR_VAL , HELPER_TEXT_COLOR_VAL , 1.0f ) ;
32
+ wrapTextStyle . normal . textColor = new Color ( _HELPER_TEXT_COLOR_VAL , _HELPER_TEXT_COLOR_VAL , _HELPER_TEXT_COLOR_VAL , 1.0f ) ;
33
33
34
34
EditorGUILayout . LabelField ( "Generate a palette for building colorization by defining a key color, palette size and hue/saturation/value range parameters." , wrapTextStyle ) ;
35
35
@@ -39,17 +39,17 @@ override public void OnInspectorGUI()
39
39
40
40
EditorGUILayout . Space ( ) ;
41
41
42
- GUIContent keyColorContent = new GUIContent ( "Key color" , KEY_COLOR_INFO ) ;
42
+ GUIContent keyColorContent = new GUIContent ( "Key color" , _KEY_COLOR_INFO ) ;
43
43
sp . m_keyColor = EditorGUILayout . ColorField ( keyColorContent , sp . m_keyColor ) ;
44
44
45
45
EditorGUILayout . Space ( ) ;
46
46
47
- GUIContent numColorContent = new GUIContent ( "Palette Size" , NUM_COLOR_INFO ) ;
48
- sp . m_numColors = EditorGUILayout . IntSlider ( numColorContent , sp . m_numColors , NUM_COLORS_MIN , NUM_COLORS_MAX ) ;
47
+ GUIContent numColorContent = new GUIContent ( "Palette Size" , _NUM_COLOR_INFO ) ;
48
+ sp . m_numColors = EditorGUILayout . IntSlider ( numColorContent , sp . m_numColors , _NUM_COLORS_MIN , _NUM_COLORS_MAX ) ;
49
49
50
- GUIContent hueRangeContent = new GUIContent ( "Hue Range" , HUE_RANGE_INFO ) ;
51
- GUIContent satRangeContent = new GUIContent ( "Saturation Range" , SAT_RANGE_INFO ) ;
52
- GUIContent valRangeContent = new GUIContent ( "Value Range" , VAL_RANGE_INFO ) ;
50
+ GUIContent hueRangeContent = new GUIContent ( "Hue Range" , _HUE_RANGE_INFO ) ;
51
+ GUIContent satRangeContent = new GUIContent ( "Saturation Range" , _SAT_RANGE_INFO ) ;
52
+ GUIContent valRangeContent = new GUIContent ( "Value Range" , _VAL_RANGE_INFO ) ;
53
53
54
54
sp . m_hueRange = EditorGUILayout . Slider ( hueRangeContent , sp . m_hueRange , 0 , 1 ) ;
55
55
sp . m_saturationRange = EditorGUILayout . Slider ( satRangeContent , sp . m_saturationRange , 0 , 1 ) ;
@@ -72,7 +72,7 @@ override public void OnInspectorGUI()
72
72
{
73
73
for ( int i = 0 ; i < sp . m_colors . Length ; i ++ )
74
74
{
75
- string fieldName = string . Format ( COLOR_FIELD_PREFIX , i ) ;
75
+ string fieldName = string . Format ( _COLOR_FIELD_PREFIX , i ) ;
76
76
sp . m_colors [ i ] = EditorGUILayout . ColorField ( fieldName , sp . m_colors [ i ] ) ;
77
77
}
78
78
}
0 commit comments