Exemple #1
0
 /// <summary>
 /// Draw the marker for waypoint that is in the process of being added
 /// </summary>
 public static void DrawMarker()
 {
     // Only handle on repaint events
     if (windowMode == WindowMode.Add && Event.current.type == EventType.Repaint)
     {
         Util.DrawWaypoint(targetBody, double.Parse(latitude), double.Parse(longitude), double.Parse(altitude), template.id, template.seed);
     }
 }
        public void OnGUI()
        {
            if (visible)
            {
                if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                {
                    newClick = true;
                }

                if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    // Draw the marker for custom waypoints that are currently being created
                    CustomWaypointGUI.DrawMarker();

                    // Draw waypoints if not in career mode
                    if (ContractSystem.Instance == null && MapView.MapIsEnabled)
                    {
                        foreach (WaypointData wpd in WaypointData.Waypoints)
                        {
                            if (wpd.celestialBody != null && wpd.waypoint.celestialName == wpd.celestialBody.name)
                            {
                                if (Event.current.type == EventType.Repaint)
                                {
                                    wpd.SetAlpha();
                                    Util.DrawWaypoint(wpd.celestialBody, wpd.waypoint.latitude, wpd.waypoint.longitude,
                                                      wpd.waypoint.altitude, wpd.waypoint.id, wpd.waypoint.seed, wpd.currentAlpha);
                                }

                                // Handling clicking on the waypoint
                                if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                                {
                                    HandleClick(wpd);
                                }

                                // Draw hint text
                                if (Event.current.type == EventType.Repaint)
                                {
                                    HintText(wpd);
                                }
                            }
                        }
                    }
                }

                if (HighLogic.LoadedSceneIsFlight && !MapView.MapIsEnabled)
                {
                    SetupStyles();

                    WaypointData.CacheWaypointData();

                    foreach (WaypointData wpd in WaypointData.Waypoints)
                    {
                        DrawWaypoint(wpd);
                    }
                }

                if (HighLogic.LoadedSceneIsFlight && (!MapView.MapIsEnabled || ContractSystem.Instance == null))
                {
                    ShowNavigationWindow();
                }
            }
        }