EditWaypoint() public static method

Interface for showing the edit waypoint dialog.
public static EditWaypoint ( Waypoint waypoint, bool stock = false ) : void
waypoint Waypoint
stock bool
return void
        private void NavigationWindow(int windowID)
        {
            if (selectedWaypoint == null)
            {
                return;
            }

            GUILayout.BeginVertical();
            if (!Util.IsNavPoint(selectedWaypoint))
            {
                if (GUILayout.Button("Activate Navigation", HighLogic.Skin.button, GUILayout.ExpandWidth(true)))
                {
                    NavWaypoint.fetch.Setup(selectedWaypoint);
                    NavWaypoint.fetch.Activate();
                    selectedWaypoint = null;
                }
            }
            else
            {
                if (GUILayout.Button("Deactivate Navigation", HighLogic.Skin.button, GUILayout.ExpandWidth(true)))
                {
                    NavWaypoint.fetch.Clear();
                    NavWaypoint.fetch.Deactivate();
                    selectedWaypoint = null;
                }
            }
            if (CustomWaypoints.Instance.IsCustom(selectedWaypoint))
            {
                if (GUILayout.Button("Edit Custom Waypoint", HighLogic.Skin.button, GUILayout.ExpandWidth(true)))
                {
                    CustomWaypointGUI.EditWaypoint(selectedWaypoint);
                    selectedWaypoint = null;
                }
                if (GUILayout.Button("Delete Custom Waypoint", HighLogic.Skin.button, GUILayout.ExpandWidth(true)))
                {
                    CustomWaypointGUI.DeleteWaypoint(selectedWaypoint);
                    selectedWaypoint = null;
                }
            }
            GUILayout.EndVertical();
        }
Beispiel #2
0
        protected void WaypointLineGUI(WaypointData wpd)
        {
            if (!wpd.waypoint.visible)
            {
                return;
            }

            GUILayout.BeginHorizontal(GUILayout.Height(32));

            // Contract icon
            GUILayout.Label(ContractIcon(wpd), GUILayout.ExpandWidth(false), GUILayout.Height(38), GUILayout.Width(38));
            GUILayout.Space(2);

            // Celestial body icon
            GUILayout.Label(CelestialBodyIcon(wpd.celestialBody.name), GUILayout.ExpandWidth(false));
            GUILayout.Space(2);

            GUILayout.BeginVertical();

            // Waypoint name, distance
            GUILayout.BeginHorizontal();
            string name = wpd.waypoint.name;

            if (wpd.waypoint.isClustered)
            {
                name += " " + StringUtilities.IntegerToGreek(wpd.waypoint.index);
            }
            GUILayout.Label(name, labelStyle, GUILayout.Height(16), GUILayout.Width(GUI_WIDTH - 240), GUILayout.ExpandWidth(false));
            if (FlightGlobals.currentMainBody == wpd.celestialBody)
            {
                GUILayout.Label("Dist: " + Util.PrintDistance(wpd), labelStyle, GUILayout.Height(16), GUILayout.ExpandWidth(false));
            }
            GUILayout.EndHorizontal();

            // Waypoint location
            GUILayout.BeginHorizontal();
            GUILayout.Label("Lat: " + Util.FormatCoordinate(wpd.waypoint.latitude, true), labelStyle, GUILayout.Height(16), GUILayout.Width(GUI_WIDTH / 2.0f - 72.0f), GUILayout.ExpandWidth(false));
            GUILayout.Label("Lon: " + Util.FormatCoordinate(wpd.waypoint.longitude, false), labelStyle, GUILayout.Height(16), GUILayout.ExpandWidth(false));
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();

            if (CustomWaypoints.Instance.IsCustom(wpd.waypoint))
            {
                GUILayout.BeginVertical();
                GUILayout.Space(8);
                GUILayout.BeginHorizontal();

                if (GUILayout.Button(new GUIContent(Config.editWaypointIcon, "Edit Waypoint"), GUI.skin.label))
                {
                    CustomWaypointGUI.EditWaypoint(wpd.waypoint);
                }
                if (GUILayout.Button(new GUIContent(Config.deleteWaypointIcon, "Delete Waypoint"), GUI.skin.label))
                {
                    CustomWaypointGUI.DeleteWaypoint(wpd.waypoint);
                }

                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
            }

            // Active waypoint toggle
            GUILayout.BeginVertical();
            GUILayout.Space(8);
            bool isNavPoint = Util.IsNavPoint(wpd.waypoint);

            if (GUILayout.Toggle(isNavPoint, (string)null) != isNavPoint)
            {
                if (isNavPoint)
                {
                    NavWaypoint.fetch.Clear();
                    NavWaypoint.fetch.Deactivate();
                }
                else
                {
                    NavWaypoint.fetch.Setup(wpd.waypoint);
                    NavWaypoint.fetch.Activate();
                }
            }
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            GUILayout.Space(6);
        }
        protected void WaypointLineGUI(WaypointData wpd)
        {
            GUILayout.BeginHorizontal(GUILayout.Height(32));

            // Contract icon
            GUILayout.Label(ContractIcon(wpd), GUILayout.ExpandWidth(false), GUILayout.Height(38));
            GUILayout.Space(2);

            // Celestial body icon
            GUILayout.Label(CelestialBodyIcon(wpd.celestialBody.name), GUILayout.ExpandWidth(false));
            GUILayout.Space(2);

            GUILayout.BeginVertical();

            // Waypoint name
            string name = wpd.waypoint.name;

            if (wpd.waypoint.isClustered)
            {
                name += " " + StringUtilities.IntegerToGreek(wpd.waypoint.index);
            }
            GUILayout.Label(name, labelStyle, GUILayout.Height(16), GUILayout.ExpandWidth(false));

            // Waypoint distance
            GUILayout.Label("Distance: " + Util.PrintDistance(wpd), labelStyle, GUILayout.Height(16), GUILayout.ExpandWidth(false));

            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();

            if (CustomWaypoints.Instance.IsCustom(wpd.waypoint))
            {
                GUILayout.BeginVertical();
                GUILayout.Space(8);
                GUILayout.BeginHorizontal();

                if (GUILayout.Button(new GUIContent(Config.editWaypointIcon, "Edit Waypoint"), GUI.skin.label))
                {
                    CustomWaypointGUI.EditWaypoint(wpd.waypoint);
                }
                if (GUILayout.Button(new GUIContent(Config.deleteWaypointIcon, "Delete Waypoint"), GUI.skin.label))
                {
                    CustomWaypointGUI.DeleteWaypoint(wpd.waypoint);
                }

                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
            }

            // Active waypoint toggle
            GUILayout.BeginVertical();
            GUILayout.Space(8);
            bool isNavPoint = Util.IsNavPoint(wpd.waypoint);

            if (GUILayout.Toggle(isNavPoint, (string)null) != isNavPoint)
            {
                if (isNavPoint)
                {
                    FinePrint.WaypointManager.clearNavPoint();
                }
                else
                {
                    FinePrint.WaypointManager.setupNavPoint(wpd.waypoint);
                    FinePrint.WaypointManager.activateNavPoint();
                }
            }
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            GUILayout.Space(6);
        }