public void OnGUI() { if (Event.current.type == EventType.Repaint && MapView.MapIsEnabled) { foreach (ISatellite s in RTCore.Instance.Satellites.FindCommandStations().Concat(RTCore.Instance.Network.GroundStations.Values)) { bool showOnMapview = true; var worldPos = ScaledSpace.LocalToScaledSpace(s.Position); if (MapView.MapCamera.transform.InverseTransformPoint(worldPos).z < 0f) continue; Vector3 pos = PlanetariumCamera.Camera.WorldToScreenPoint(worldPos); var screenRect = new Rect((pos.x - 8), (Screen.height - pos.y) - 8, 16, 16); // Hide the current ISatellite if it is behind its body if (RTSettings.Instance.HideGroundStationsBehindBody && IsOccluded(s.Position, s.Body)) showOnMapview = false; if (RTSettings.Instance.HideGroundStationsOnDistance && !IsOccluded(s.Position, s.Body) && this.IsCamDistanceToWide(s.Position)) showOnMapview = false; // orbiting remote stations are always shown if(s.isVessel && !s.parentVessel.Landed) showOnMapview = true; if (showOnMapview) { Color pushColor = GUI.color; // tint the white mark.png into the defined color GUI.color = s.MarkColor; // draw the mark.png GUI.DrawTexture(screenRect, mTexMark, ScaleMode.ScaleToFit, true); GUI.color = pushColor; // Show Mouse over informations to the ground station if (RTSettings.Instance.ShowMouseOverInfoGroundStations && s is MissionControlSatellite && screenRect.ContainsMouse()) { Rect headline = screenRect; Vector2 nameDim = this.smallStationHead.CalcSize(new GUIContent(s.Name)); headline.x -= nameDim.x + 10; headline.y -= 3; headline.width = nameDim.x; headline.height = 14; // draw headline of the station GUI.Label(headline, s.Name, this.smallStationHead); // loop antennas String antennaRanges = String.Empty; foreach (var antenna in s.Antennas) { if(antenna.Omni > 0) { antennaRanges += "Omni: "+ RTUtil.FormatSI(antenna.Omni,"m") + Environment.NewLine; } if (antenna.Dish > 0) { antennaRanges += "Dish: " + RTUtil.FormatSI(antenna.Dish, "m") + Environment.NewLine; } } if(!antennaRanges.Equals(String.Empty)) { Rect antennas = screenRect; GUIContent content = new GUIContent(antennaRanges); Vector2 antennaDim = this.smallStationText.CalcSize(content); float maxHeight = this.smallStationText.CalcHeight(content, antennaDim.x); antennas.y += headline.height - 3; antennas.x -= antennaDim.x + 10; antennas.width = antennaDim.x; antennas.height = maxHeight; // draw antenna infos of the station GUI.Label(antennas, antennaRanges, this.smallStationText); } } } } } }