Added GUI stuff from base Core. Working on relocating the icon which isn't working for who knows why. editordev
[VOID.git] / VOID_EditorCore.cs
blob:a/VOID_EditorCore.cs -> blob:b/VOID_EditorCore.cs
--- a/VOID_EditorCore.cs
+++ b/VOID_EditorCore.cs
@@ -68,15 +68,24 @@
 		public VOID_EditorCore() : base()
 		{
 			this._Name = "VOID Editor Core";
+		}
 
-			this.VOIDIconPos = new Rect(Screen.width - 60, Screen.height - 30, 30, 30);
-		}
+		public new void OnGUI() {}
 
 		public override void DrawGUI()
 		{
 			if (!this._modulesLoaded)
 			{
 				this.LoadModulesOfType<IVOID_EditorModule>();
+			}
+
+			Rect _iconPos = Tools.DockToWindow (this.VOIDIconPos, this.mainWindowPos);
+
+			_iconPos = Tools.ClampRectToScreen (_iconPos, (int)_iconPos.width, (int)_iconPos.height);
+
+			if (_iconPos != this.VOIDIconPos)
+			{
+				this.VOIDIconPos = _iconPos;
 			}
 
 			base.DrawGUI();
@@ -101,21 +110,23 @@
 				}
 			}
 
-			if (EditorLogic.startPod == null)
+			if (EditorLogic.startPod == null || !HighLogic.LoadedSceneIsEditor)
 			{
 				this.StopGUI();
 				return;
 			}
-			else if (!this.guiRunning)
+			else if (!this.guiRunning && HighLogic.LoadedSceneIsEditor)
 			{
 				this.StartGUI();
 			}
 
 			if (EditorLogic.SortedShipList.Count > 0)
 			{
-				SimManager.Instance.Gravity = 9.08665;
+				SimManager.Instance.Gravity = VOID_Data.KerbinGee;
 				SimManager.Instance.TryStartSimulation();
 			}
+
+			this.CheckAndSave ();
 		}
 
 		public new void FixedUpdate() {}