HUDs: Fixes to Save and Load processes to make HUDs properly save their positions again.
[VOID.git] / VOID_HUDAdvanced.cs
blob:a/VOID_HUDAdvanced.cs -> blob:b/VOID_HUDAdvanced.cs
--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -72,7 +72,7 @@
 		 * */
 		public VOID_HUDAdvanced() : base()
 		{
-			this._Name = "Advanced Heads-Up Display";
+			this.Name = "Advanced Heads-Up Display";
 
 			this.toggleActive = true;
 
@@ -149,7 +149,12 @@
 				leftHUD.Append(string.Intern("-- POWER LOST --"));
 			}
 
-			GUILayout.Label(leftHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+			GUILayout.Label(
+				leftHUD.ToString(),
+				VOID_Styles.labelHud,
+				GUILayout.ExpandWidth(true),
+				GUILayout.ExpandHeight(true)
+			);
 
 			if (!this.positionsLocked)
 			{
@@ -208,7 +213,12 @@
 				rightHUD.Append(string.Intern("-- POWER LOST --"));
 			}
 
-			GUILayout.Label(rightHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+			GUILayout.Label(
+				rightHUD.ToString(),
+				VOID_Styles.labelHud,
+				GUILayout.ExpandWidth(true),
+				GUILayout.ExpandHeight(true)
+			);
 
 			if (!this.positionsLocked)
 			{
@@ -231,11 +241,22 @@
 				}
 			}
 
+			if (VOID_Data.upcomingManeuverNodes < 1 && this.Windows.Contains(this.rightHUD))
+			{
+				this.Windows.Remove(this.rightHUD);
+			}
+			else if (VOID_Data.upcomingManeuverNodes > 0 && !this.Windows.Contains(this.rightHUD))
+			{
+				this.Windows.Add(this.rightHUD);
+			}
+
 			base.DrawGUI();
 		}
 
 		public override void DrawConfigurables()
 		{
+			base.DrawConfigurables();
+
 			if (GUILayout.Button(string.Intern("Reset Advanced HUD Positions"), GUILayout.ExpandWidth(false)))
 			{
 				foreach (HUDWindow window in this.Windows)
@@ -244,9 +265,7 @@
 				}
 			}
 
-			this.positionsLocked = GUILayout.Toggle(this.positionsLocked,
-				string.Intern("Lock Advanced HUD Positions"),
-				GUILayout.ExpandWidth(false));
+			this.positionsLocked = GUITools.Toggle(this.positionsLocked, string.Intern("Lock Advanced HUD Positions"));
 		}
 	}
 }