Ejemplo n.º 1
0
        /// <summary>
        /// Draws the Conics window.
        /// </summary>
        /// <param name="id">Identifier.</param>
        public void drawConicsWindow(int id)
        {
            PatchedConicSolver solver = NodeTools.getSolver();
            Color defaultColor        = GUI.backgroundColor;

            GUILayout.BeginVertical();

            // Conics mode controls
            GUILayout.BeginHorizontal();
            GUILayout.Label("Conics mode: ", GUILayout.Width(100));
            GUIParts.drawButton("0", (options.conicsMode == 0?Color.yellow:defaultColor), delegate() { options.setConicsMode(0); });
            GUIParts.drawButton("1", (options.conicsMode == 1?Color.yellow:defaultColor), delegate() { options.setConicsMode(1); });
            GUIParts.drawButton("2", (options.conicsMode == 2?Color.yellow:defaultColor), delegate() { options.setConicsMode(2); });
            GUIParts.drawButton("3", (options.conicsMode == 3?Color.yellow:defaultColor), delegate() { options.setConicsMode(3); });
            GUIParts.drawButton("4", (options.conicsMode == 4?Color.yellow:defaultColor), delegate() { options.setConicsMode(4); });
            GUILayout.EndHorizontal();

            // conics patch limit editor.
            GUILayout.BeginHorizontal();
            GUILayout.Label("Change Conics Samples", GUILayout.Width(200));
            GUIParts.drawButton("-", Color.red, delegate() { solver.DecreasePatchLimit(); });
            GUIParts.drawButton("+", Color.red, delegate() { solver.IncreasePatchLimit(); });
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws the Node Editor window.
        /// </summary>
        /// <param name="id">Identifier.</param>
        public void drawMainWindow(int id)
        {
            Color defaultColor        = GUI.backgroundColor;
            Color contentColor        = GUI.contentColor;
            Color curColor            = defaultColor;
            PatchedConicSolver solver = NodeTools.getSolver();

            // Options button
            if (showOptions)
            {
                GUI.backgroundColor = Color.green;
            }
            if (GUI.Button(new Rect(options.mainWindowPos.width - 48, 2, 22, 18), "O"))
            {
                showOptions = !showOptions;
            }
            GUI.backgroundColor = defaultColor;

            // Keymapping button
            if (showKeymapper)
            {
                GUI.backgroundColor = Color.green;
            }
            if (GUI.Button(new Rect(options.mainWindowPos.width - 24, 2, 22, 18), "K"))
            {
                showKeymapper = !showKeymapper;
            }
            GUI.backgroundColor = defaultColor;

            GUILayout.BeginVertical();
            if (options.showManeuverPager)
            {
                GUIParts.drawManeuverPager(curState);
            }

            // Human-readable time
            GUIParts.drawDoubleLabel("Time:", 100, NodeTools.convertUTtoHumanTime(curState.currentUT()), 130);

            // Increment buttons
            GUILayout.BeginHorizontal();
            GUILayout.Label("Increment:", GUILayout.Width(100));
            GUIParts.drawButton("0.01", (options.increment == 0.01?Color.yellow:defaultColor), delegate() { options.increment = 0.01; });
            GUIParts.drawButton("0.1", (options.increment == 0.1?Color.yellow:defaultColor), delegate() { options.increment = 0.1; });
            GUIParts.drawButton("1", (options.increment == 1?Color.yellow:defaultColor), delegate() { options.increment = 1; });
            GUIParts.drawButton("10", (options.increment == 10?Color.yellow:defaultColor), delegate() { options.increment = 10; });
            GUIParts.drawButton("100", (options.increment == 100?Color.yellow:defaultColor), delegate() { options.increment = 100; });
            GUILayout.EndHorizontal();

            drawTimeControls(contentColor);
            drawProgradeControls(contentColor);
            drawNormalControls(contentColor);
            drawRadialControls(contentColor);

            // total delta-V display
            GUIParts.drawDoubleLabel("Total delta-V:", 100, curState.currentMagnitude().ToString("0.##") + "m/s", 130);

            drawEAngle();
            drawEncounter(defaultColor);

            // Conics mode controls
            GUILayout.BeginHorizontal();
            GUILayout.Label("Conics mode: ", GUILayout.Width(100));
            GUIParts.drawButton("0", (options.conicsMode == 0?Color.yellow:defaultColor), delegate() { options.setConicsMode(0); });
            GUIParts.drawButton("1", (options.conicsMode == 1?Color.yellow:defaultColor), delegate() { options.setConicsMode(1); });
            GUIParts.drawButton("2", (options.conicsMode == 2?Color.yellow:defaultColor), delegate() { options.setConicsMode(2); });
            GUIParts.drawButton("3", (options.conicsMode == 3?Color.yellow:defaultColor), delegate() { options.setConicsMode(3); });
            GUIParts.drawButton("4", (options.conicsMode == 4?Color.yellow:defaultColor), delegate() { options.setConicsMode(4); });
            GUILayout.EndHorizontal();

            // conics patch limit editor.
            GUILayout.BeginHorizontal();
            GUILayout.Label("Change Conics Samples", GUILayout.Width(200));
            GUIParts.drawButton("-", Color.red, delegate() { solver.DecreasePatchLimit(); });
            GUIParts.drawButton("+", Color.red, delegate() { solver.IncreasePatchLimit(); });
            GUILayout.EndHorizontal();

            // trip info button and vessel focus buttons
            GUILayout.BeginHorizontal();
            GUIParts.drawButton("Trip Info", (options.showTrip?Color.yellow:defaultColor), delegate() { options.showTrip = !options.showTrip; });
            GUIParts.drawButton("Focus on Vessel", defaultColor, delegate() { MapView.MapCamera.SetTarget(FlightGlobals.ActiveVessel.vesselName); });
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow();
        }