Beispiel #1
0
 void Start()
 {
     Debug.Log("CorrectCoL_Persistent.Start");
     if (HighLogic.CurrentGame.Parameters.CustomParams <CCOLParams>().useLastPlanet)
     {
         if (lastSelectedPlanet != "")
         {
             PlanetSelection.setSelectedBody(lastSelectedPlanet);
         }
     }
 }
Beispiel #2
0
        void _drawGUI(int id)
        {
            GUILayout.BeginHorizontal(GUILayout.Width(wnd_width));
            var b = CorrectCoL.showStockMarker;

            CorrectCoL.showStockMarker = GUILayout.Toggle(CorrectCoL.showStockMarker, "Show stock marker");
            if (b != CorrectCoL.showStockMarker)
            {
                CorrectCoL.Instance.SwapMarkers();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(GUILayout.Width(wnd_width));
            GUILayout.BeginVertical(GUILayout.Width(graph_width + 10));
            // draw pitch box
            GUILayout.Label("pitch");
            GUILayout.Box(pitch_texture);
            // draw yaw box
            GUILayout.Label("yaw");
            GUILayout.Box(yaw_texture);
            GUILayout.EndVertical();
            // draw side text
            GUILayout.BeginVertical(GUILayout.Width(wnd_width - graph_width - 30));
            GUILayout.Label("side");
            bool draw = GUILayout.Button("Update");

            if (!PlanetSelection.isActive)
            {
                if (GUILayout.Button("Planet"))
                {
                    planetSelection = new GameObject().AddComponent <PlanetSelection>();
                }
            }
            autoUpdate = GUILayout.Toggle(autoUpdate, new GUIContent("Auto-update", "Update the graph after any change"));

            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("AoA range:", "AoA and sideslip range to plot, degrees"));

            aoa_range_str = GUILayout.TextField(aoa_range_str);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("AoA marks:", "Horizontal axis marks step, degrees"));
            aoa_mark_delta_str = GUILayout.TextField(aoa_mark_delta_str);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("AoA compress:", "Zero for 1:1 AoA axis, positive for quadratic compression.\nHelps to focus on important stuff near zero AoA while not loosing large-AoA behaviour"));
            aoa_compress_str = GUILayout.TextField(aoa_compress_str);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Speed:", "Speed towards root part nose direction, m/s.\nEnter negative values to analyze retrograde stability."));
            speed_str = GUILayout.TextField(speed_str);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Altitude:", "Meters above sea level"));
            alt_str = GUILayout.TextField(alt_str);
            GUILayout.EndHorizontal();
            //GUILayout.BeginHorizontal();
            //    GUILayout.Label("pitch:");
            //    pitch_ctrl_str = GUILayout.TextField(pitch_ctrl_str);
            //GUILayout.EndHorizontal();


            // traits system
            GUILayout.Space(15.0f);
            gui_traits();
            GUILayout.Space(15.0f);

            var color = GUI.color;

            GUI.color = Color.blue;
            GUILayout.Label(new GUIContent("Lift to Drag ratio", "Shows the ratio of lift to drag, higher is better"));
            GUILayout.Label(new GUIContent("Colored vertical lines", "Shows AoA on wich Lift equals -(gravity + centrifugal).\nGreen line displays required AoA for level flight at current mass.\nYellow line displays required AoA for level flight with a dry craft."));
            GUI.color = color;
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();


            if (Event.current.type == EventType.Repaint && GUI.tooltip != tooltip)
            {
                tooltip = GUI.tooltip;
            }

            GUI.DragWindow();

            if (draw)
            {
                update_graphs();
            }
        }