First pass at the Oribtal module port.
[VOID.git] / VOID_Core.cs
blob:a/VOID_Core.cs -> blob:b/VOID_Core.cs
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -55,6 +55,8 @@
 			}
 		}
 
+		public static double Constant_G = 6.674e-11;
+
 		/*
 		 * Fields
 		 * */
@@ -90,6 +92,9 @@
 		protected string VOIDIconOffPath = "VOID/Textures/void_icon_off";
 
 		protected int windowBaseID = -96518722;
+		protected int _windowID = 0;
+
+		protected Dictionary<string, GUIStyle> _LabelStyles = new Dictionary<string, GUIStyle>();
 
 		[AVOID_SaveValue("togglePower")]
 		public VOID_SaveValue<bool> togglePower = true;
@@ -135,11 +140,27 @@
 			}
 		}
 
-		public Vessel vessel
+		public int windowID
 		{
 			get
 			{
-				return FlightGlobals.ActiveVessel;
+				if (this._windowID == 0)
+				{
+				this._windowID = this.windowBaseID;
+				}
+				return this._windowID;
+			}
+			set
+			{
+				this._windowID = value;
+			}
+		}
+
+		public Dictionary<string, GUIStyle> LabelStyles
+		{
+			get
+			{
+				return this._LabelStyles;
 			}
 		}
 
@@ -152,6 +173,19 @@
 
 			this.VOIDIconOn = GameDatabase.Instance.GetTexture (this.VOIDIconOnPath, false);
 			this.VOIDIconOff = GameDatabase.Instance.GetTexture (this.VOIDIconOffPath, false);
+
+			this.LabelStyles["center"] = new GUIStyle(GUI.skin.label);
+			this.LabelStyles["center"].normal.textColor = Color.white;
+			this.LabelStyles["center"].alignment = TextAnchor.UpperCenter;
+
+			this.LabelStyles["center_bold"] = new GUIStyle(GUI.skin.label);
+			this.LabelStyles["center_bold"].normal.textColor = Color.white;
+			this.LabelStyles["center_bold"].alignment = TextAnchor.UpperCenter;
+			this.LabelStyles["center_bold"].fontStyle = FontStyle.Bold;
+
+			this.LabelStyles["txt_right"] = new GUIStyle(GUI.skin.label);
+			this.LabelStyles["txt_right"].normal.textColor = Color.white;
+			this.LabelStyles["txt_right"].alignment = TextAnchor.UpperRight;
 
 			this.LoadConfig ();
 		}
@@ -323,8 +357,6 @@
 
 			GUI.skin = this.Skin;
 
-			int windowID = this.windowBaseID;
-
 			this.VOIDIconTexture = this.VOIDIconOff;  //icon off default
 			if (this.togglePower) this.VOIDIconTexture = this.VOIDIconOn;     //or on if power_toggle==true
 			if (GUI.Button(new Rect(VOIDIconPos), VOIDIconTexture, new GUIStyle()))
@@ -337,7 +369,7 @@
 				Rect _mainWindowPos = this.mainWindowPos;
 
 				_mainWindowPos = GUILayout.Window (
-					++windowID,
+					++this.windowID,
 					_mainWindowPos,
 					this.VOIDMainWindow,
 					string.Join (" ", new string[] {this.VoidName, this.VoidVersion}),
@@ -356,7 +388,7 @@
 				Rect _configWindowPos = this.configWindowPos;
 
 				_configWindowPos = GUILayout.Window (
-					++windowID,
+					++this.windowID,
 					_configWindowPos,
 					this.VOIDConfigWindow,
 					string.Join (" ", new string[] {this.VoidName, "Configuration"}),