@@ -10,24 +10,37 @@ public static class ModWindowHelper
1010 {
1111 static float topPad = 30f ;
1212 static float leftPad = 0f ;
13- static float vspacing = 30f ; // same as radioListItemHeight
14- static float textFieldPadding = 10f ; // same as radioListItemHeight
13+ static float vspacing = 30f ;
14+ static float textFieldPadding = 10f ;
15+ static float horizontalSliderPadding = 10f ;
1516 static float curY = topPad ;
1617 static float curX = leftPad ;
1718
19+ static float horizontalSliderHeight = 60f ;
20+ static float radioListItemHeight = 30f ;
21+
1822 // NOTE: could get away from this if went with an instance...
19- static public void Reset ( )
23+ public static void Reset ( )
2024 {
2125 curY = topPad ;
2226 curX = leftPad ;
2327 }
2428
25- static public void MakeLabel ( Rect inRect , string label )
29+ public static float HorizontalSlider ( Rect rect , float value , float leftValue , float rightValue , bool middleAlignment = false , string label = null , string leftAlignedLabel = null , string rightAlignedLabel = null , float roundTo = - 1f )
30+ {
31+ curY += horizontalSliderPadding ;
32+ Rect r = GetRect ( horizontalSliderHeight , rect . width ) ;
33+ float val = Widgets . HorizontalSlider ( r , value , leftValue , rightValue , middleAlignment , label , leftAlignedLabel , rightAlignedLabel , roundTo ) ;
34+ curY += horizontalSliderPadding ;
35+ return val ;
36+ }
37+
38+ public static void MakeLabel ( Rect inRect , string label )
2639 {
2740 MakeLabel ( inRect . width - 64f , label ) ;
2841 }
2942
30- static public void MakeLabeledTextField ( Rect inRect , string label , ref string val )
43+ public static void MakeLabeledTextField ( Rect inRect , string label , ref string val )
3144 {
3245 curY += textFieldPadding ;
3346 Widgets . Label ( new Rect ( 0f , curY + 5f , inRect . width - 16f , 40f ) , label ) ;
@@ -36,34 +49,33 @@ static public void MakeLabeledTextField(Rect inRect, string label, ref string va
3649 }
3750
3851 // TODO: rewrite this -> it's ugly.
39- static public void MakeTextFieldNumericLabeled < T > ( Rect inRect , string label , ref T val , ref string buffer , float min , float max ) where T : struct
52+ public static void MakeTextFieldNumericLabeled < T > ( Rect inRect , string label , ref T val , ref string buffer , float min , float max ) where T : struct
4053 {
4154 curY += textFieldPadding ;
4255 Widgets . TextFieldNumericLabeled < T > ( new Rect ( 0f , curY + 5f , inRect . width - 16f , 40f ) , label , ref val , ref buffer , min , max ) ;
4356 curY += vspacing + textFieldPadding ;
4457 }
4558
46- static private void MakeLabel ( float width , string label )
59+ private static void MakeLabel ( float width , string label )
4760 {
4861 Widgets . Label ( new Rect ( 0f , curY + 5f , width - 16f , 40f ) , label ) ;
4962 curY += vspacing ;
5063 }
5164
52- static public void MakeLabeledCheckbox ( Rect inRect , string label , ref bool val )
65+ public static void MakeLabeledCheckbox ( Rect inRect , string label , ref bool val )
5366 {
5467 MakeLabeledCheckbox ( inRect . width , label , ref val ) ;
5568 }
5669
57- static private void MakeLabeledCheckbox ( float width , string label , ref bool val )
70+ private static void MakeLabeledCheckbox ( float width , string label , ref bool val )
5871 {
5972 // NOTE: consider breaking out more of these numbers
6073 Widgets . Label ( new Rect ( 0f , curY + 5f , width - 16f , 40f ) , label ) ;
6174 Widgets . Checkbox ( width - 64f , curY + 6f , ref val ) ;
6275 curY += vspacing ;
6376 }
6477
65- static float radioListItemHeight = 30f ;
66- static public void MakeLabeledRadioList < T > ( Rect inRect , List < LabeledRadioValue < T > > items , ref T val )
78+ public static void MakeLabeledRadioList < T > ( Rect inRect , List < LabeledRadioValue < T > > items , ref T val )
6779 {
6880 foreach ( LabeledRadioValue < T > item in items )
6981 {
@@ -78,12 +90,12 @@ static public void MakeLabeledRadioList<T>(Rect inRect, List<LabeledRadioValue<T
7890 }
7991
8092 // NOTE: consider using an enum...
81- static public void MakeLabeledRadioList ( Rect inRect , string [ ] labels , ref string val )
93+ public static void MakeLabeledRadioList ( Rect inRect , string [ ] labels , ref string val )
8294 {
8395 MakeLabeledRadioList < string > ( inRect , GenerateLabeledRadioValues ( labels ) , ref val ) ;
8496 }
8597
86- static public List < LabeledRadioValue < string > > GenerateLabeledRadioValues ( string [ ] labels )
98+ public static List < LabeledRadioValue < string > > GenerateLabeledRadioValues ( string [ ] labels )
8799 {
88100 List < LabeledRadioValue < string > > list = new List < LabeledRadioValue < string > > ( ) ;
89101 foreach ( string label in labels )
@@ -93,13 +105,13 @@ static public List<LabeledRadioValue<string>> GenerateLabeledRadioValues(string[
93105 return list ;
94106 }
95107
96- static public void MakeLabeledRadioList < T > ( Rect inRect , Dictionary < string , T > dict , ref T val )
108+ public static void MakeLabeledRadioList < T > ( Rect inRect , Dictionary < string , T > dict , ref T val )
97109 {
98110 MakeLabeledRadioList < T > ( inRect , GenerateLabeledRadioValues < T > ( dict ) , ref val ) ;
99111 }
100112
101113 // (label, value) => (key, value)
102- static public List < LabeledRadioValue < T > > GenerateLabeledRadioValues < T > ( Dictionary < string , T > dict )
114+ public static List < LabeledRadioValue < T > > GenerateLabeledRadioValues < T > ( Dictionary < string , T > dict )
103115 {
104116 List < LabeledRadioValue < T > > list = new List < LabeledRadioValue < T > > ( ) ;
105117 foreach ( KeyValuePair < string , T > entry in dict )
@@ -133,7 +145,7 @@ public T Value
133145 }
134146 }
135147
136- static public Rect GetRect ( float height , float width )
148+ public static Rect GetRect ( float height , float width )
137149 {
138150 // NOTE: come back to the concept of `ColumnWidth`
139151 Rect result = new Rect ( curX , curY , width , height ) ;
0 commit comments