@@ -31,27 +31,35 @@ public enum Panels
31
31
MouseInspector
32
32
}
33
33
34
+ public enum VerticalAnchor
35
+ {
36
+ Top ,
37
+ Bottom
38
+ }
39
+
34
40
public static bool Initializing { get ; private set ; } = true ;
35
41
42
+ private static readonly Dictionary < Panels , UIPanel > UIPanels = new Dictionary < Panels , UIPanel > ( ) ;
43
+
44
+ public static VerticalAnchor NavbarAnchor = VerticalAnchor . Top ;
45
+
46
+ // References
36
47
public static GameObject CanvasRoot { get ; private set ; }
37
48
public static Canvas Canvas { get ; private set ; }
38
49
public static EventSystem EventSys { get ; private set ; }
39
50
40
51
internal static GameObject PoolHolder { get ; private set ; }
41
52
42
- // panels
43
53
internal static GameObject PanelHolder { get ; private set ; }
44
- private static readonly Dictionary < Panels , UIPanel > UIPanels = new Dictionary < Panels , UIPanel > ( ) ;
45
54
46
- // assets
47
55
internal static Font ConsoleFont { get ; private set ; }
48
56
internal static Shader BackupShader { get ; private set ; }
49
57
50
- // Main Navbar UI
51
58
public static RectTransform NavBarRect ;
52
59
public static GameObject NavbarButtonHolder ;
53
60
public static Dropdown MouseInspectDropdown ;
54
61
62
+ // defaults
55
63
internal static readonly Color enabledButtonColor = new Color ( 0.2f , 0.4f , 0.28f ) ;
56
64
internal static readonly Color disabledButtonColor = new Color ( 0.25f , 0.25f , 0.25f ) ;
57
65
@@ -140,6 +148,7 @@ public static void Update()
140
148
141
149
UIPanel . UpdateFocus ( ) ;
142
150
PanelDragger . UpdateInstances ( ) ;
151
+ InputFieldRef . UpdateInstances ( ) ;
143
152
UIBehaviourModel . UpdateInstances ( ) ;
144
153
}
145
154
@@ -212,16 +221,41 @@ private static void CreateRootCanvas()
212
221
PanelHolder . transform . SetAsFirstSibling ( ) ;
213
222
}
214
223
224
+ public static void SetNavBarAnchor ( )
225
+ {
226
+ switch ( NavbarAnchor )
227
+ {
228
+ case VerticalAnchor . Top :
229
+ NavBarRect . anchorMin = new Vector2 ( 0.5f , 1f ) ;
230
+ NavBarRect . anchorMax = new Vector2 ( 0.5f , 1f ) ;
231
+ NavBarRect . anchoredPosition = new Vector2 ( NavBarRect . anchoredPosition . x , 0 ) ;
232
+ NavBarRect . sizeDelta = new Vector2 ( 900f , 35f ) ;
233
+ break ;
234
+
235
+ case VerticalAnchor . Bottom :
236
+ NavBarRect . anchorMin = new Vector2 ( 0.5f , 0f ) ;
237
+ NavBarRect . anchorMax = new Vector2 ( 0.5f , 0f ) ;
238
+ NavBarRect . anchoredPosition = new Vector2 ( NavBarRect . anchoredPosition . x , 35 ) ;
239
+ NavBarRect . sizeDelta = new Vector2 ( 900f , 35f ) ;
240
+ break ;
241
+ }
242
+ }
243
+
215
244
private static void CreateTopNavBar ( )
216
245
{
217
246
var navbarPanel = UIFactory . CreateUIObject ( "MainNavbar" , CanvasRoot ) ;
218
247
UIFactory . SetLayoutGroup < HorizontalLayoutGroup > ( navbarPanel , false , true , true , true , 5 , 4 , 4 , 4 , 4 , TextAnchor . MiddleCenter ) ;
219
248
navbarPanel . AddComponent < Image > ( ) . color = new Color ( 0.1f , 0.1f , 0.1f ) ;
220
249
NavBarRect = navbarPanel . GetComponent < RectTransform > ( ) ;
221
250
NavBarRect . pivot = new Vector2 ( 0.5f , 1f ) ;
222
- NavBarRect . anchorMin = new Vector2 ( 0.5f , 1f ) ;
223
- NavBarRect . anchorMax = new Vector2 ( 0.5f , 1f ) ;
224
- NavBarRect . sizeDelta = new Vector2 ( 900f , 35f ) ;
251
+
252
+ NavbarAnchor = ConfigManager . Main_Navbar_Anchor . Value ;
253
+ SetNavBarAnchor ( ) ;
254
+ ConfigManager . Main_Navbar_Anchor . OnValueChanged += ( VerticalAnchor val ) =>
255
+ {
256
+ NavbarAnchor = val ;
257
+ SetNavBarAnchor ( ) ;
258
+ } ;
225
259
226
260
// UnityExplorer title
227
261
0 commit comments