private void DetectorWindowGUI(int windowID) { #region Detector GUILayout.BeginVertical(); if (Vessel.mainBody != null && KethaneController.PlanetTextures.ContainsKey(Vessel.mainBody.name)) { Texture2D planetTex = KethaneController.PlanetTextures[Vessel.mainBody.name]; GUILayout.Box(planetTex); Rect Last = UnityEngine.GUILayoutUtility.GetLastRect(); int x = Misc.GetXOnMap(Misc.clampDegrees(Vessel.mainBody.GetLongitude(Vessel.transform.position)), planetTex.width); int y = Misc.GetYOnMap(Vessel.mainBody.GetLatitude(Vessel.transform.position), planetTex.height); GUI.DrawTexture(new Rect(((Last.xMin + Last.xMax) / 2) - (planetTex.width / 2) + x - (youAreHereMarker.width / 2), ((Last.yMin + Last.yMax) / 2) + (planetTex.height / 2) - y - (youAreHereMarker.height / 2), 7, 7), youAreHereMarker); float xVar = ((Last.xMin + Last.xMax) / 2) - (planetTex.width / 2) + DetectorWindowPosition.x; float yVar = ((Last.yMin + Last.yMax) / 2) - (planetTex.height / 2) + DetectorWindowPosition.y; xVar = xVar - UnityEngine.Input.mousePosition.x; yVar = (Screen.height - yVar) - UnityEngine.Input.mousePosition.y; bool inbound = true; if (yVar > planetTex.height || yVar < 0) { inbound = false; } if (-xVar > planetTex.width || -xVar < 0) { inbound = false; } GUILayout.Label(String.Format(inbound ? "Mouse coordinates: {0:0.0}, {1:0.0}" : "Mouse coordinates: -", Misc.GetLatOnMap(yVar, planetTex.height), Misc.GetLonOnMap(xVar, planetTex.width))); } GUILayout.Label(String.Format("Last deposit: {0:0.000}, {1:0.000} ({2:F0}L)", LastLat, LastLon, LastQuantity)); ScanningSound = GUILayout.Toggle(ScanningSound, "Detection sound"); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, 300, 60)); #endregion }