Got the VOID windows and icon behaving acceptably in the editor.
[VOID.git] / VOIDFlightMaster.cs
blob:a/VOIDFlightMaster.cs -> blob:b/VOIDFlightMaster.cs
--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -48,15 +48,15 @@
 		{
 			Tools.PostDebugMessage ("VOIDFlightMaster: Waking up.");
 			this.Core = (VOID_Core)VOID_Core.Instance;
-			this.Core.StopGUI ();
-			this.Core.StartGUI ();
+			this.Core.ResetGUI ();
 			Tools.PostDebugMessage ("VOIDFlightMaster: Awake.");
 		}
 
 		public void Update()
 		{
-			if (!HighLogic.LoadedSceneIsEditor)
+			if (!HighLogic.LoadedSceneIsFlight && this.Core != null)
 			{
+				this.Core.SaveConfig ();
 				this.Core = null;
 				VOID_Core.Reset();
 				return;
@@ -71,7 +71,8 @@
 
 			if (this.Core.vessel != null)
 			{
-				SimManager.Instance.Gravity = VOID_Core.Instance.vessel.mainBody.gravParameter / Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
+				SimManager.Instance.Gravity = VOID_Core.Instance.vessel.mainBody.gravParameter /
+					Math.Pow(VOID_Core.Instance.vessel.mainBody.Radius, 2);
 				SimManager.Instance.TryStartSimulation();
 			}
 
@@ -113,15 +114,15 @@
 		{
 			Tools.PostDebugMessage ("VOIDEditorMaster: Waking up.");
 			this.Core = VOID_EditorCore.Instance;
-			this.Core.StopGUI ();
-			this.Core.StartGUI ();
+			this.Core.ResetGUI ();
 			Tools.PostDebugMessage ("VOIDEditorMaster: Awake.");
 		}
 
 		public void Update()
 		{
-			if (!HighLogic.LoadedSceneIsEditor)
+			if (!HighLogic.LoadedSceneIsEditor && this.Core != null)
 			{
+				this.Core.SaveConfig ();
 				this.Core = null;
 				VOID_EditorCore.Reset();
 				return;