1
- using HarmonyLib ;
2
- using System ;
3
- using System . Collections ;
4
- using System . Collections . Generic ;
5
- using System . IO ;
6
- using System . Linq ;
7
- using System . Reflection ;
8
- using System . Text ;
1
+ using System . Collections . Generic ;
9
2
using UnityEngine ;
10
- using UnityEngine . EventSystems ;
11
3
using UnityEngine . UI ;
12
4
using UnityExplorer . Config ;
13
5
using UnityExplorer . CSConsole ;
14
6
using UnityExplorer . Inspectors ;
15
7
using UnityExplorer . UI . Panels ;
16
- using UnityExplorer . UI . Widgets ;
17
8
using UnityExplorer . UI . Widgets . AutoComplete ;
18
9
using UniverseLib ;
19
10
using UniverseLib . Input ;
@@ -48,10 +39,10 @@ public enum VerticalAnchor
48
39
49
40
public static bool Initializing { get ; internal set ; } = true ;
50
41
51
- private static UIBase uiBase ;
52
- public static GameObject UIRoot => uiBase ? . RootObject ;
53
- public static RectTransform UIRootRect => _uiRootRect ??= UIRoot . GetComponent < RectTransform > ( ) ;
54
- private static RectTransform _uiRootRect ;
42
+ internal static UIBase UiBase { get ; private set ; }
43
+ public static GameObject UIRoot => UiBase ? . RootObject ;
44
+ public static RectTransform UIRootRect { get ; private set ; }
45
+ public static Canvas UICanvas { get ; private set ; }
55
46
56
47
internal static GameObject PanelHolder { get ; private set ; }
57
48
private static readonly Dictionary < Panels , UIPanel > UIPanels = new ( ) ;
@@ -71,10 +62,10 @@ public enum VerticalAnchor
71
62
72
63
public static bool ShowMenu
73
64
{
74
- get => uiBase != null && uiBase . Enabled ;
65
+ get => UiBase != null && UiBase . Enabled ;
75
66
set
76
67
{
77
- if ( uiBase == null || ! UIRoot || uiBase . Enabled == value )
68
+ if ( UiBase == null || ! UIRoot || UiBase . Enabled == value )
78
69
return ;
79
70
80
71
UniversalUI . SetUIActive ( ExplorerCore . GUID , value ) ;
@@ -85,11 +76,16 @@ public static bool ShowMenu
85
76
86
77
internal static void InitUI ( )
87
78
{
88
- uiBase = UniversalUI . RegisterUI ( ExplorerCore . GUID , Update ) ;
79
+ UiBase = UniversalUI . RegisterUI ( ExplorerCore . GUID , Update ) ;
89
80
90
- lastScreenWidth = Screen . width ;
91
- lastScreenHeight = Screen . height ;
81
+ UIRootRect = UIRoot . GetComponent < RectTransform > ( ) ;
82
+ UICanvas = UIRoot . GetComponent < Canvas > ( ) ;
92
83
84
+ DisplayManager . Init ( ) ;
85
+
86
+ var display = DisplayManager . ActiveDisplay ;
87
+ lastScreenWidth = display . renderingWidth ;
88
+ lastScreenHeight = display . renderingHeight ;
93
89
94
90
// Create UI.
95
91
CreatePanelHolder ( ) ;
@@ -169,7 +165,8 @@ public static void Update()
169
165
}
170
166
171
167
// check screen dimension change
172
- if ( Screen . width != lastScreenWidth || Screen . height != lastScreenHeight )
168
+ var display = DisplayManager . ActiveDisplay ;
169
+ if ( display . renderingWidth != lastScreenWidth || display . renderingHeight != lastScreenHeight )
173
170
OnScreenDimensionsChanged ( ) ;
174
171
}
175
172
@@ -233,8 +230,9 @@ public static void SetNavBarAnchor()
233
230
234
231
private static void OnScreenDimensionsChanged ( )
235
232
{
236
- lastScreenWidth = Screen . width ;
237
- lastScreenHeight = Screen . height ;
233
+ var display = DisplayManager . ActiveDisplay ;
234
+ lastScreenWidth = display . renderingWidth ;
235
+ lastScreenHeight = display . renderingHeight ;
238
236
239
237
foreach ( var panel in UIPanels )
240
238
{
@@ -254,6 +252,8 @@ private static void Master_Toggle_OnValueChanged(KeyCode val)
254
252
closeBtn . ButtonText . text = val . ToString ( ) ;
255
253
}
256
254
255
+ // Time controls
256
+
257
257
private static void OnTimeInputEndEdit ( string val )
258
258
{
259
259
if ( pauseButtonPausing )
0 commit comments