@@ -35,7 +35,7 @@ public override void CreateIValue(object value, Type fallbackType)
35
35
{
36
36
IValue = InteractiveValue . Create ( value , fallbackType ) ;
37
37
IValue . Owner = this ;
38
- IValue . m_mainContentParent = m_rightGroup ;
38
+ IValue . m_mainContentParent = m_mainGroup ;
39
39
IValue . m_subContentParent = this . m_subContent ;
40
40
}
41
41
@@ -52,26 +52,28 @@ public override void SetValue()
52
52
ConfigManager . Handler . OnAnyConfigChanged ( ) ;
53
53
}
54
54
55
- internal GameObject m_leftGroup ;
56
- internal GameObject m_rightGroup ;
55
+ internal GameObject m_mainGroup ;
56
+ //internal GameObject m_leftGroup;
57
+ //internal GameObject m_rightGroup;
58
+ //internal GameObject m_secondRow;
57
59
58
60
internal override void ConstructUI ( )
59
61
{
60
62
base . ConstructUI ( ) ;
61
63
62
- var vertGroup = UIFactory . CreateVerticalGroup ( m_mainContent , "ConfigHolder" , true , false , true , true , 5 , new Vector4 ( 2 , 2 , 2 , 2 ) ) ;
64
+ m_mainGroup = UIFactory . CreateVerticalGroup ( m_mainContent , "ConfigHolder" , true , false , true , true , 5 , new Vector4 ( 2 , 2 , 2 , 2 ) ) ;
63
65
64
- var horiGroup = UIFactory . CreateHorizontalGroup ( vertGroup , "ConfigEntryHolder" , true , false , true , true ) ;
66
+ var horiGroup = UIFactory . CreateHorizontalGroup ( m_mainGroup , "ConfigEntryHolder" , false , false , true , true , childAlignment : TextAnchor . MiddleLeft ) ;
65
67
UIFactory . SetLayoutElement ( horiGroup , minHeight : 30 , flexibleHeight : 0 ) ;
66
68
67
- // left group
69
+ //// left group
68
70
69
- m_leftGroup = UIFactory . CreateHorizontalGroup ( horiGroup , "ConfigTitleGroup" , false , false , true , true , 4 , default , new Color ( 1 , 1 , 1 , 0 ) ) ;
70
- UIFactory . SetLayoutElement ( m_leftGroup , minHeight : 25 , flexibleHeight : 0 , minWidth : 125 , flexibleWidth : 200 ) ;
71
+ // m_leftGroup = UIFactory.CreateHorizontalGroup(horiGroup, "ConfigTitleGroup", false, false, true, true, 4, default, new Color(1, 1, 1, 0));
72
+ // UIFactory.SetLayoutElement(m_leftGroup, minHeight: 25, flexibleHeight: 0, minWidth: 200 , flexibleWidth: 0 );
71
73
72
74
// config entry label
73
75
74
- var configLabel = UIFactory . CreateLabel ( m_leftGroup , "ConfigLabel" , this . RefConfig . Name , TextAnchor . MiddleLeft ) ;
76
+ var configLabel = UIFactory . CreateLabel ( horiGroup , "ConfigLabel" , this . RefConfig . Name , TextAnchor . MiddleLeft ) ;
75
77
var leftRect = configLabel . GetComponent < RectTransform > ( ) ;
76
78
leftRect . anchorMin = Vector2 . zero ;
77
79
leftRect . anchorMax = Vector2 . one ;
@@ -80,23 +82,39 @@ internal override void ConstructUI()
80
82
leftRect . sizeDelta = Vector2 . zero ;
81
83
UIFactory . SetLayoutElement ( configLabel . gameObject , minWidth : 250 , minHeight : 25 , flexibleWidth : 0 , flexibleHeight : 0 ) ;
82
84
83
- // right group
85
+ // Default button
84
86
85
- m_rightGroup = UIFactory . CreateVerticalGroup ( horiGroup , "ConfigValueGroup" , false , false , true , true , 2 , new Vector4 ( 4 , 2 , 0 , 0 ) ,
86
- new Color ( 1 , 1 , 1 , 0 ) ) ;
87
- UIFactory . SetLayoutElement ( m_rightGroup , minHeight : 25 , minWidth : 150 , flexibleHeight : 0 , flexibleWidth : 5000 ) ;
87
+ var defaultButton = UIFactory . CreateButton ( horiGroup ,
88
+ "RevertDefaultButton" ,
89
+ "Default" ,
90
+ ( ) => { RefConfig . RevertToDefaultValue ( ) ; } ,
91
+ new Color ( 0.3f , 0.3f , 0.3f ) ) ;
92
+ UIFactory . SetLayoutElement ( defaultButton . gameObject , minWidth : 80 , minHeight : 22 , flexibleWidth : 0 ) ;
93
+
94
+ //// right group
95
+
96
+ //m_rightGroup = UIFactory.CreateVerticalGroup(horiGroup, "ConfigValueGroup", false, false, true, true, 4, default, new Color(1, 1, 1, 0));
97
+ //UIFactory.SetLayoutElement(m_rightGroup, minHeight: 25, minWidth: 150, flexibleHeight: 0, flexibleWidth: 5000);
98
+
99
+ // Description label
100
+
101
+ var desc = UIFactory . CreateLabel ( m_mainGroup , "Description" , $ "<i>{ RefConfig . Description } </i>", TextAnchor . MiddleLeft , Color . grey ) ;
102
+ UIFactory . SetLayoutElement ( desc . gameObject , minWidth : 250 , minHeight : 20 , flexibleWidth : 9999 , flexibleHeight : 0 ) ;
103
+
104
+ //// Second row (IValue)
105
+
106
+ //m_secondRow = UIFactory.CreateHorizontalGroup(m_mainGroup, "DescriptionRow", false, false, true, true, 4, new Color(0.08f, 0.08f, 0.08f));
107
+
108
+ // IValue
88
109
89
110
if ( IValue != null )
90
111
{
91
- IValue . m_mainContentParent = m_rightGroup ;
112
+ IValue . m_mainContentParent = m_mainGroup ;
92
113
IValue . m_subContentParent = this . m_subContent ;
93
114
}
94
115
95
- // Config description label
96
-
97
- UIFactory . CreateLabel ( vertGroup , "Description" , $ "<i>{ RefConfig . Description } </i>", TextAnchor . MiddleLeft , Color . grey ) ;
98
-
99
- m_subContent . transform . SetAsLastSibling ( ) ;
116
+ // makes the subcontent look nicer
117
+ m_subContent . transform . SetParent ( m_mainGroup . transform , false ) ;
100
118
}
101
119
}
102
120
}
0 commit comments