Skip to content

Commit 067a053

Browse files
Fix UI issue of missing signal delay and flight computer button and update to hide this UI if EVA construction panel is opened (KSP 1.11)
1 parent 5521c76 commit 067a053

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/RemoteTech/UI/TimeWarpDecorator.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using RemoteTech.SimpleTypes;
44
using UnityEngine;
55
using KSP.UI;
6-
using KSP.UI.Screens.Flight;
76
using KSP.Localization;
87

98
namespace RemoteTech.UI
@@ -17,7 +16,7 @@ public class TimeWarpDecorator
1716
/// <summary>
1817
/// Image for position access
1918
/// </summary>
20-
private UnityEngine.UI.Image mTimewarpImage;
19+
private UnityEngine.RectTransform mTimewarpTransform;
2120
/// <summary>
2221
/// Delay-Text style
2322
/// </summary>
@@ -115,11 +114,11 @@ public TimeWarpDecorator()
115114
GameObject go = GameObject.Find("TimeQuadrant");
116115
if (go)
117116
{
118-
mTimewarpImage = go.GetComponent<UnityEngine.UI.Image>();
117+
mTimewarpTransform = go.GetComponent<UnityEngine.RectTransform>();
119118
}
120119

121120
// objects on this scene?
122-
if (mTimewarpImage == null || TimeWarp.fetch == null)
121+
if (mTimewarpTransform == null || TimeWarp.fetch == null)
123122
{
124123
return;
125124
}
@@ -138,17 +137,21 @@ public TimeWarpDecorator()
138137
public void Draw()
139138
{
140139
// no drawing without timewarp object
141-
if (mTimewarpImage == null)
140+
if (mTimewarpTransform == null)
142141
return;
143142

144-
// no drawing with in-flight action group panel is opened
143+
// no drawing if in-flight action group panel is opened
145144
if(ActionGroupsFlightController.Instance != null && ActionGroupsFlightController.Instance.IsOpen)
146145
return;
147146

148-
Vector2 timeWarpImageScreenCoord = UIMainCamera.Camera.WorldToScreenPoint(mTimewarpImage.rectTransform.position);
147+
// no drawing if in-flight construction panel is opened
148+
if (EVAConstructionModeController.Instance != null && EVAConstructionModeController.Instance.IsOpen)
149+
return;
150+
151+
Vector2 timeWarpImageScreenCoord = UIMainCamera.Camera.WorldToScreenPoint(mTimewarpTransform.position);
149152

150153
float scale = GameSettings.UI_SCALE_TIME * GameSettings.UI_SCALE;
151-
float topLeftTotimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpImage.preferredHeight * scale));
154+
float topLeftTotimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpTransform.rect.height * scale));
152155
float texBackgroundHeight = (mTexBackground.height * 0.7f) * scale;
153156
float texBackgroundWidth = (mTexBackground.width * 0.8111f) * scale;
154157

0 commit comments

Comments
 (0)