From 067a053c99efb8744e3583c884c2d0c6ec8bedf3 Mon Sep 17 00:00:00 2001 From: KSP-TaxiService Date: Sat, 19 Dec 2020 23:23:58 +0800 Subject: [PATCH] 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) --- src/RemoteTech/UI/TimeWarpDecorator.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/RemoteTech/UI/TimeWarpDecorator.cs b/src/RemoteTech/UI/TimeWarpDecorator.cs index 7e4300d5f..f9d7ca194 100644 --- a/src/RemoteTech/UI/TimeWarpDecorator.cs +++ b/src/RemoteTech/UI/TimeWarpDecorator.cs @@ -3,7 +3,6 @@ using RemoteTech.SimpleTypes; using UnityEngine; using KSP.UI; -using KSP.UI.Screens.Flight; using KSP.Localization; namespace RemoteTech.UI @@ -17,7 +16,7 @@ public class TimeWarpDecorator /// /// Image for position access /// - private UnityEngine.UI.Image mTimewarpImage; + private UnityEngine.RectTransform mTimewarpTransform; /// /// Delay-Text style /// @@ -115,11 +114,11 @@ public TimeWarpDecorator() GameObject go = GameObject.Find("TimeQuadrant"); if (go) { - mTimewarpImage = go.GetComponent(); + mTimewarpTransform = go.GetComponent(); } // objects on this scene? - if (mTimewarpImage == null || TimeWarp.fetch == null) + if (mTimewarpTransform == null || TimeWarp.fetch == null) { return; } @@ -138,17 +137,21 @@ public TimeWarpDecorator() public void Draw() { // no drawing without timewarp object - if (mTimewarpImage == null) + if (mTimewarpTransform == null) return; - // no drawing with in-flight action group panel is opened + // no drawing if in-flight action group panel is opened if(ActionGroupsFlightController.Instance != null && ActionGroupsFlightController.Instance.IsOpen) return; - Vector2 timeWarpImageScreenCoord = UIMainCamera.Camera.WorldToScreenPoint(mTimewarpImage.rectTransform.position); + // no drawing if in-flight construction panel is opened + if (EVAConstructionModeController.Instance != null && EVAConstructionModeController.Instance.IsOpen) + return; + + Vector2 timeWarpImageScreenCoord = UIMainCamera.Camera.WorldToScreenPoint(mTimewarpTransform.position); float scale = GameSettings.UI_SCALE_TIME * GameSettings.UI_SCALE; - float topLeftTotimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpImage.preferredHeight * scale)); + float topLeftTotimeQuadrant = Screen.height - (timeWarpImageScreenCoord.y - (mTimewarpTransform.rect.height * scale)); float texBackgroundHeight = (mTexBackground.height * 0.7f) * scale; float texBackgroundWidth = (mTexBackground.width * 0.8111f) * scale;