setUT() public method

public setUT ( String s ) : void
s String
return void
Esempio n. 1
0
        private void drawTimeControls(Color contentColor)
        {
            // Universal time controls
            GUILayout.BeginHorizontal();
            GUILayout.Label((options.largeUTIncrement?"UT: (x10 inc)":"UT:"), GUILayout.Width(100));
            if (!curState.timeParsed)
            {
                GUI.contentColor = Color.red;
            }
            string check = GUILayout.TextField(curState.timeText, GUILayout.Width(100));

            if (!curState.timeText.Equals(check, StringComparison.Ordinal))
            {
                curState.setUT(check);
            }
            GUI.contentColor = contentColor;
            double currentUT    = curState.currentUT();
            double ut_increment = options.increment * (options.largeUTIncrement ? 10.0 : 1.0);

            GUIParts.drawPlusMinusButtons(() => { curState.addUT(ut_increment); }, () => { curState.addUT(-ut_increment); },
                                          true, curState.node.patch.isUTInsidePatch(currentUT - ut_increment));
            GUILayout.EndHorizontal();

            // extended time controls
            if (options.showUTControls)
            {
                Orbit targ = NodeTools.getTargetOrbit();

                GUILayout.BeginHorizontal();
                GUIParts.drawButton("Peri", Color.yellow, () => { curState.setPeriapsis(); });
                GUI.enabled = curState.node.hasDN(targ);
                GUIParts.drawButton("DN", Color.magenta, () => {
                    if (targ != null)
                    {
                        curState.setUT(curState.node.patch.getTargetDNUT(targ));
                    }
                    else
                    {
                        curState.setUT(curState.node.patch.getEquatorialDNUT());
                    }
                });
                if (options.largeUTIncrement)
                {
                    GUI.enabled = curState.node.patch.isUTInsidePatch(currentUT - curState.node.patch.period);
                    GUIParts.drawButton("-Orb", Color.red, () => { curState.addUT(-curState.node.patch.period); });
                    GUI.enabled = curState.node.patch.isUTInsidePatch(currentUT + curState.node.patch.period);
                    GUIParts.drawButton("+Orb", Color.green, () => { curState.addUT(curState.node.patch.period); });
                }
                else
                {
                    GUI.enabled = curState.node.patch.isUTInsidePatch(currentUT - 1000);
                    GUIParts.drawButton("-1K", Color.red, () => { curState.addUT(-1000); });
                    GUI.enabled = true;
                    GUIParts.drawButton("+1K", Color.green, () => { curState.addUT(1000); });
                }
                GUI.enabled = curState.node.hasAN(targ);
                GUIParts.drawButton("AN", Color.cyan, () => {
                    if (targ != null)
                    {
                        curState.setUT(curState.node.patch.getTargetANUT(targ));
                    }
                    else
                    {
                        curState.setUT(curState.node.patch.getEquatorialANUT());
                    }
                });
                GUI.enabled = curState.node.patch.hasAP();
                GUIParts.drawButton("Apo", Color.blue, () => { curState.setApoapsis(); });
                GUILayout.EndHorizontal();
            }

            GUI.enabled = true;
        }
Esempio n. 2
0
        // debugging function
        private void drawTimeControls(Color contentColor)
        {
            // Universal time controls
            GUILayout.BeginHorizontal();
            GUILayout.Label((options.largeUTIncrement?"UT: (10x inc)":"UT:"), GUILayout.Width(100));
            GUI.backgroundColor = Color.green;
            if (!curState.timeParsed)
            {
                GUI.contentColor = Color.red;
            }
            string check = GUILayout.TextField(curState.timeText, GUILayout.Width(100));

            if (!curState.timeText.Equals(check, StringComparison.Ordinal))
            {
                curState.setUT(check);
            }
            GUI.contentColor = contentColor;
            double ut_increment = options.increment * (options.largeUTIncrement ? 10.0 : 1.0);

            GUIParts.drawButton("-", Color.red, delegate() { curState.addUT(ut_increment * -1.0); });
            GUIParts.drawButton("+", Color.green, delegate() { curState.addUT(ut_increment); });
            GUILayout.EndHorizontal();

            // extended time controls
            if (options.showUTControls)
            {
                GUILayout.BeginHorizontal();
                GUIParts.drawButton("Peri", Color.yellow, delegate() { curState.setPeriapsis(); });
                GUIParts.drawButton("DN", Color.magenta, delegate() {
                    Orbit targ = NodeTools.getTargetOrbit();
                    if (targ != null)
                    {
                        curState.setUT(NodeTools.getTargetDNUT(curState.node.patch, targ));
                    }
                    else
                    {
                        curState.setUT(NodeTools.getEquatorialDNUT(curState.node.patch));
                    }
                });
                if (options.largeUTIncrement)
                {
                    GUIParts.drawButton("-Orb", Color.red, delegate() { curState.addUT(-curState.node.patch.period); });
                    GUIParts.drawButton("+Orb", Color.green, delegate() { curState.addUT(curState.node.patch.period); });
                }
                else
                {
                    GUIParts.drawButton("-1K", Color.red, delegate() { curState.addUT(-1000); });
                    GUIParts.drawButton("+1K", Color.green, delegate() { curState.addUT(1000); });
                }
                GUIParts.drawButton("AN", Color.cyan, delegate() {
                    Orbit targ = NodeTools.getTargetOrbit();
                    if (targ != null)
                    {
                        curState.setUT(NodeTools.getTargetANUT(curState.node.patch, targ));
                    }
                    else
                    {
                        curState.setUT(NodeTools.getEquatorialANUT(curState.node.patch));
                    }
                });
                GUIParts.drawButton("Apo", Color.blue, delegate() { curState.setApoapsis(); });
                GUILayout.EndHorizontal();
            }
        }