You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CustomizableUIProject/Manager.cs
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
usingBepInEx.Logging;
2
2
usingKSP.Game;
3
3
usingKSP.Messages;
4
-
usingKSP.UI.Binding;
5
4
usingUnityEngine;
6
5
7
6
namespaceCustomizableUI
@@ -32,6 +31,16 @@ public static Manager Instance
32
31
}
33
32
}
34
33
34
+
publicvoidUpdate()
35
+
{
36
+
// I wish we don't have to do this, but initialization often fails when triggered via OnGameStateEntered, since the app.bar sometimes doesn't finish initializing when scene is triggered
// We calculate at what % of the screen the UI group is.
157
+
// Since Transform.position (0, 0, z) indicates a pixel at the middle of the screen and since each UI group can be offset differently, we need to do some algebra hacks.
158
+
// Reference resolution is 1920 x 1080, but Main canvas uses something more like 1815 x 1023 (?!). 907.5 is half of horizontal res, 511.5 half of vertical.
// For Y, Transform.position and IMGUI coordinates are reversed. Transfer.position counts bottom-up and IMGUI draws up-bottom. So we reverse the percent.
0 commit comments