Example #1
0
        public void Draw()
        {
            float width3 = 156 / 3 - GUI.skin.button.margin.right * 2.0f / 3.0f;

            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    GUIStyle guiTableRow = new GUIStyle(HighLogic.Skin.label);
                    guiTableRow.normal.textColor = Color.white;

                    RTUtil.FakeStateButton(new GUIContent("HBNT", "Ultra-low power hibernation with all active antennas shut down."), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Hibernate)), (int)mPowerMode, (int)PowerModes.Hibernate, GUILayout.Width(width3));
                    RTUtil.FakeStateButton(new GUIContent("THLD", "Optimally adaptive power-saving threshold control on all antennas"), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.AntennaSaver)), (int)mPowerMode, (int)PowerModes.AntennaSaver, GUILayout.Width(width3));
                    RTUtil.Button(new GUIContent("WAKE", "Terminate any power-saving state."), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Wake)), GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(300);

                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    RTUtil.Button(new GUIContent(">>", "Toggles the queue and delay functionality."),
                                  mOnClickQueue, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Example #2
0
        /// <summary>
        /// Draws the content of the AlternativeRules section
        /// </summary>
        private void drawAlternativeRulesContent()
        {
            GUILayout.Space(10);
            this.mSettings.EnableSignalDelay = GUILayout.Toggle(this.mSettings.EnableSignalDelay, (this.mSettings.EnableSignalDelay) ? "Signal delay enabled" : "Signal delay disabled");
            GUILayout.Label("If set, then all commands sent to RemoteTech-compatible probe cores will be delayed, depending on the distance to the probe and the SpeedOfLight. If unset, then all commands will be executed instantaneously, so long as there is a connection of any length between the probe and Mission Control.", this.mGuiHintText);

            GUILayout.Label("Range Model type", GUILayout.Width(OptionWindow.WINDOW_WIDTH * 0.75f));
            GUILayout.Label("This setting controls how the game determines whether two antennas are in range of each other. Read more on our online manual about the difference for each rule.", this.mGuiHintText);
            GUILayout.BeginHorizontal();
            {
                RTUtil.FakeStateButton(new GUIContent("Standard"), () => this.mSettings.RangeModelType = RangeModel.RangeModel.Standard, (int)this.mSettings.RangeModelType, (int)RangeModel.RangeModel.Standard, GUILayout.Height(20));
                RTUtil.FakeStateButton(new GUIContent("Root"), () => this.mSettings.RangeModelType     = RangeModel.RangeModel.Additive, (int)this.mSettings.RangeModelType, (int)RangeModel.RangeModel.Additive, GUILayout.Height(20));
            }
            GUILayout.EndHorizontal();

            GUILayout.Label("Multiple Antenna Multiplier : (" + this.mSettings.MultipleAntennaMultiplier + ")", GUILayout.Width(OptionWindow.WINDOW_WIDTH * 0.75f));
            GUILayout.Label("This setting lets multiple omnidirectional antennas on the same craft act as a single, slightly larger antenna. The default value of 0.0 means that omni antennas do not boost each other; a value of 1.0 means that the effective range of the satellite equals the total range of all omni antennas on board. The effective range scales linearly between these two extremes. This option works with both the Standard and Root range models.", this.mGuiHintText);
            this.mSettings.MultipleAntennaMultiplier = GUILayout.HorizontalSlider((float)this.mSettings.MultipleAntennaMultiplier, 0, 1);
            if (this.mSettings.MultipleAntennaMultiplier <= 0.49)
            {
                this.mSettings.MultipleAntennaMultiplier = 0;
            }
            else
            {
                this.mSettings.MultipleAntennaMultiplier = 1;
            }
        }
Example #3
0
        public void Draw()
        {
            float width3 = 156 / 3 - GUI.skin.button.margin.right * 2.0f / 3.0f;

            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    GUIStyle guiTableRow = new GUIStyle(HighLogic.Skin.label);
                    guiTableRow.normal.textColor = Color.white;

                    RTUtil.FakeStateButton(new GUIContent("HBNT", "Ultra-low power state with activated antennas shut down."), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Hibernate)), (int)mPowerMode, (int)PowerModes.Hibernate, GUILayout.Width(width3));
                    GUILayout.Label("", new GUILayoutOption[] { GUILayout.Width(width3) });
                    RTUtil.Button(new GUIContent("WAKE", "Exit from a power-saving state."), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Wake)), GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(200);

                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    RTUtil.Button(new GUIContent(">>", "Toggles the queue and delay functionality."),
                                  mOnClickQueue, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Example #4
0
        /// <summary>
        /// Draws the content of the AlternativeRules section
        /// </summary>
        private void drawAlternativeRulesContent()
        {
            GUILayout.Space(10);
            this.mSettings.EnableSignalDelay = GUILayout.Toggle(this.mSettings.EnableSignalDelay, (this.mSettings.EnableSignalDelay) ? "Signal delay enabled" : "Signal delay disabled");
            GUILayout.Label("ON: All commands sent to RemoteTech-compatible probe cores are limited by the speed of light and have a delay before executing, based on distance.\nOFF: All commands will be executed immediately, although a working connection to Mission Control is still required.", this.mGuiHintText);

            GUILayout.Label("Range Model Mode", GUILayout.Width(OptionWindow.WINDOW_WIDTH * 0.75f));
            GUILayout.Label("This setting controls how the game determines whether two antennas are in range of each other.\nRead more on our online manual about the difference for each rule.", this.mGuiHintText);
            GUILayout.BeginHorizontal();
            {
                RTUtil.FakeStateButton(new GUIContent("Standard"), () => this.mSettings.RangeModelType = RangeModel.RangeModel.Standard, (int)this.mSettings.RangeModelType, (int)RangeModel.RangeModel.Standard, GUILayout.Height(20));
                RTUtil.FakeStateButton(new GUIContent("Root"), () => this.mSettings.RangeModelType     = RangeModel.RangeModel.Additive, (int)this.mSettings.RangeModelType, (int)RangeModel.RangeModel.Additive, GUILayout.Height(20));
            }
            GUILayout.EndHorizontal();

            GUILayout.Label("Multiple Antenna Multiplier : (" + this.mSettings.MultipleAntennaMultiplier + ")", GUILayout.Width(OptionWindow.WINDOW_WIDTH * 0.75f));
            GUILayout.Label("Multiple omnidirectional antennas on the same craft work together.\nThe default value of 0 means this is disabled.\nThe largest value of 1.0 sums the range of all omnidirectional antennas to provide a greater effective range.\nThe effective range scales linearly and this option works with both the Standard and Root range models.", this.mGuiHintText);
            this.mSettings.MultipleAntennaMultiplier = GUILayout.HorizontalSlider((float)this.mSettings.MultipleAntennaMultiplier, 0, 1);
            if (this.mSettings.MultipleAntennaMultiplier <= 0.49)
            {
                this.mSettings.MultipleAntennaMultiplier = 0;
            }
            else
            {
                this.mSettings.MultipleAntennaMultiplier = 1;
            }
        }
Example #5
0
        /// <summary>
        /// Draws the option menu
        /// </summary>
        private void drawOptionMenu()
        {
            GUILayout.BeginHorizontal();
            {
                // push the font size of buttons
                var pushFontsize = GUI.skin.button.fontSize;
                GUI.skin.button.fontSize = 11;

                foreach (OPTION_MENUS menu in Enum.GetValues(typeof(OPTION_MENUS)))
                {
                    RTUtil.FakeStateButton(new GUIContent(menu.ToString()), () => this.mMenuValue = (int)menu, this.mMenuValue, (int)menu, GUILayout.Height(16));
                }

                // pop the saved button size back
                GUI.skin.button.fontSize = pushFontsize;
            }
            GUILayout.EndHorizontal();
        }
Example #6
0
        /// <summary>
        /// Draws all debug logs
        /// </summary>
        private void drawRTDebugLogEntrys()
        {
            GUIStyle lablestyle = new GUIStyle(GUI.skin.label);

            lablestyle.wordWrap         = false;
            lablestyle.fontSize         = 11;
            lablestyle.normal.textColor = Color.white;

            // draw the vertical buttons for each debug lvl
            GUILayout.BeginHorizontal();
            {
                var pushFontsize = GUI.skin.button.fontSize;
                GUI.skin.button.fontSize = 11;
                foreach (RTLogLevel lvl in Enum.GetValues(typeof(RTLogLevel)))
                {
                    RTUtil.FakeStateButton(new GUIContent(lvl.ToString()), () => { this.currentLogLevel = lvl; }, (int)currentLogLevel, (int)lvl, GUILayout.Height(16));
                }
                GUI.skin.button.fontSize = pushFontsize;
            }
            GUILayout.EndHorizontal();

            // draw the input of the selected debug list
            debugLogScrollPosition = GUILayout.BeginScrollView(debugLogScrollPosition);
            {
                foreach (var logEntry in RTLog.RTLogList[this.currentLogLevel])
                {
                    GUILayout.Label(logEntry, lablestyle, GUILayout.Height(13));
                }
            }
            GUILayout.EndScrollView();

            // If the mouse is not over the debug window we will flip the scrollposition.y to maximum
            if (!this.backupPosition.ContainsMouse())
            {
                debugLogScrollPosition.y = Mathf.Infinity;
            }
        }
Example #7
0
        public void Draw()
        {
            float width3 = 156 / 3 - GUI.skin.button.margin.right * 2.0f / 3.0f;

            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_PowerFragment_HBNT"), Localizer.Format("#RT_PowerFragment_HBNT_desc")), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Hibernate)), (int)mPowerMode, (int)PowerModes.Hibernate, GUILayout.Width(width3));       //"HBNT", "Ultra-low power hibernation with all active antennas shut down."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_PowerFragment_THLD"), Localizer.Format("#RT_PowerFragment_THLD_desc")), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.AntennaSaver)), (int)mPowerMode, (int)PowerModes.AntennaSaver, GUILayout.Width(width3)); //"THLD", "Optimally adaptive power-saving threshold control on all antennas"
                    RTUtil.Button(new GUIContent(Localizer.Format("#RT_PowerFragment_WAKE"), Localizer.Format("#RT_PowerFragment_WAKE_desc")), () => RTCore.Instance.StartCoroutine(OnPowerClick(PowerModes.Wake)), GUILayout.Width(width3));                                                                 //"WAKE", "Terminate any power-saving state."
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(200);

                GUILayout.BeginHorizontal();
                {
                    RTUtil.Button(new GUIContent(">>", Localizer.Format("#RT_PowerFragment_Queue_desc")),//"Toggles the queue and delay functionality."
                                  mOnClickQueue, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Example #8
0
        /// <summary>
        /// Draws the content of the window
        /// </summary>
        public override void Window(int uid)
        {
            // push the current GUI.skin
            var pushSkin = GUI.skin;

            GUI.skin = HighLogic.Skin;

            GUILayout.BeginVertical(GUILayout.Width(500), GUILayout.Height(350));
            {
                #region Draw debug menue
                // Draw the debug menue
                GUILayout.BeginHorizontal();
                {
                    // push the font size of buttons
                    var pushFontsize = GUI.skin.button.fontSize;
                    GUI.skin.button.fontSize = 11;

                    int menueItemCounter = 0;
                    foreach (string menueItem in this.debugMenueItems)
                    {
                        RTUtil.FakeStateButton(new GUIContent(menueItem), () => { this.currentDebugMenue = menueItemCounter; }, currentDebugMenue, menueItemCounter, GUILayout.Height(16));
                        menueItemCounter++;
                    }

                    // pop the saved button size back
                    GUI.skin.button.fontSize = pushFontsize;
                }
                GUILayout.EndHorizontal();
                #endregion

                #region Draw content
                contentScrollPosition = GUILayout.BeginScrollView(contentScrollPosition);
                {
                    switch (this.currentDebugMenue)
                    {
                    case 0: { this.drawRTSettingsTab(); break; }

                    case 1: { this.drawAPITester(); break; }

                    case 2: { this.drawGuidReader(); break; }

                    default: { GUILayout.Label("Item " + this.currentDebugMenue.ToString() + " not yet implemented"); break; }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndScrollView();
                #endregion

                #region Draw debug log
                // Draw a 100 height debug-console at the bottom of the debug-window
                GUILayout.BeginVertical(GUILayout.Height(150));
                this.drawRTDebugLogEntrys();
                GUILayout.EndVertical();
                // Draw the clear log button
                // Clear Logs Button
                GUILayout.BeginHorizontal();
                {
                    var pushFontsize = GUI.skin.button.fontSize;
                    GUI.skin.button.fontSize = 12;
                    RTUtil.Button(new GUIContent(Localizer.Format("#RT_DEBUG_Clearbutton", this.currentLogLevel.ToString()), Localizer.Format("#RT_DEBUG_Clearbutton_desc")), () => RTLog.RTLogList[this.currentLogLevel].Clear());//"Clear Logs in ""tbd."
                    GUI.skin.button.fontSize = pushFontsize;
                }
                GUILayout.EndHorizontal();
                #endregion
            }
            GUILayout.EndVertical();

            base.Window(uid);

            // pop back the saved skin
            GUI.skin = pushSkin;
        }
Example #9
0
        /// <summary>
        /// Draws the RTSettings section
        /// </summary>
        private void drawRTSettingsTab()
        {
            var settings      = RTSettings.Instance;
            int firstColWidth = 250;

            var pushLabelSize  = GUI.skin.label.fontSize;
            var pushButtonSize = GUI.skin.button.fontSize;

            GUI.skin.label.fontSize  = 12;
            GUI.skin.button.fontSize = 12;

            // Deaktivate Mission Control
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(Localizer.Format("#RT_DEBUG_DeactivateKSC"), GUILayout.Width(firstColWidth));//"Deactivate KSC: "
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Onbtton")), () => { foreach (MissionControlSatellite mcs in settings.GroundStations)
                                                                                                      {
                                                                                                          mcs.togglePower(false);
                                                                                                      }
                                                                                                      ; deactivatedMissionControls = 1; }, deactivatedMissionControls, 1);                                                                                            //"On"
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Offbtton")), () => { foreach (MissionControlSatellite mcs in settings.GroundStations)
                                                                                                       {
                                                                                                           mcs.togglePower(true);
                                                                                                       }
                                                                                                       ; deactivatedMissionControls = 0; }, deactivatedMissionControls, 0);                                                                                           //"Off"
            }
            GUILayout.EndHorizontal();


            GUILayout.Space(10);
            GUILayout.Label(Localizer.Format("#RT_DEBUG_CheatOptions"));//"Cheat Options"

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(Localizer.Format("#RT_DEBUG_SignalThroughBodies"), GUILayout.Width(firstColWidth));                                                            //"Signal Through Bodies: "
                int cheatLineOfSight = (RTSettings.Instance.IgnoreLineOfSight) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Onbtton")), () => { RTSettings.Instance.IgnoreLineOfSight = true; }, cheatLineOfSight, 1);   //"On"
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Offbtton")), () => { RTSettings.Instance.IgnoreLineOfSight = false; }, cheatLineOfSight, 0); //"Off"
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(Localizer.Format("#RT_DEBUG_InfiniteFuel"), GUILayout.Width(firstColWidth));                                                              //"Infinite Fuel: "
                int cheatinfiniteFuel = (CheatOptions.InfinitePropellant) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Onbtton")), () => { CheatOptions.InfinitePropellant = true; }, cheatinfiniteFuel, 1);   //"On"
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Offbtton")), () => { CheatOptions.InfinitePropellant = false; }, cheatinfiniteFuel, 0); //"Off"
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(Localizer.Format("#RT_DEBUG_InfiniteRCSFuel"), GUILayout.Width(firstColWidth));                                                              //"Infinite RCS Fuel: "
                int cheatinfiniteRCSFuel = (CheatOptions.InfinitePropellant) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Onbtton")), () => { CheatOptions.InfinitePropellant = true; }, cheatinfiniteRCSFuel, 1);   //"On"
                RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_DEBUG_Offbtton")), () => { CheatOptions.InfinitePropellant = false; }, cheatinfiniteRCSFuel, 0); //"Off"
            }
            GUILayout.EndHorizontal();

            GUI.skin.label.fontSize  = pushLabelSize;
            GUI.skin.button.fontSize = pushButtonSize;
        }
Example #10
0
        /// <summary>
        /// Draws the content of the window
        /// </summary>
        public override void Window(int uid)
        {
            // push the current GUI.skin
            var pushSkin = GUI.skin;

            GUI.skin = HighLogic.Skin;

            GUILayout.BeginVertical(GUILayout.Width(500), GUILayout.Height(350));
            {
                #region Draw debug menue
                // Draw the debug menue
                GUILayout.BeginHorizontal();
                {
                    // push the font size of buttons
                    var pushFontsize = GUI.skin.button.fontSize;
                    GUI.skin.button.fontSize = 11;

                    int menueItemCounter = 0;
                    foreach (string menueItem in this.debugMenueItems)
                    {
                        RTUtil.FakeStateButton(new GUIContent(menueItem), () => { this.currentDebugMenue = menueItemCounter; }, currentDebugMenue, menueItemCounter, GUILayout.Height(16));
                        menueItemCounter++;
                    }

                    // pop the saved button size back
                    GUI.skin.button.fontSize = pushFontsize;
                }
                GUILayout.EndHorizontal();
                #endregion

                #region Draw content
                contentScrollPosition = GUILayout.BeginScrollView(contentScrollPosition);
                {
                    switch (this.currentDebugMenue)
                    {
                    case 0: { this.drawRTSettingsTab(); break; }

                    case 1: { this.drawAPITester(); break; }

                    case 2: { this.drawGuidReader(); break; }

                    default: { GUILayout.Label("Item " + this.currentDebugMenue.ToString() + " not yet implemented"); break; }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndScrollView();
                #endregion

                #region Draw debug log
                // Draw a 100 height debug-console at the bottom of the debug-window
                GUILayout.BeginVertical(GUILayout.Height(100));
                this.drawRTDebugLogEntrys();
                GUILayout.EndVertical();
                #endregion
            }
            GUILayout.EndVertical();

            // Set a control lock that we can scroll through textareas
            InputLockManager.RemoveControlLock("RTLockDebug");
            if (this.backupPosition.ContainsMouse())
            {
                InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS, "RTLockDebug");
            }

            base.Window(uid);

            // pop back the saved skin
            GUI.skin = pushSkin;
        }
Example #11
0
        /// <summary>
        /// Draws the RTSettings section
        /// </summary>
        private void drawRTSettingsTab()
        {
            var settings      = RTSettings.Instance;
            int firstColWidth = 250;

            var pushLabelSize  = GUI.skin.label.fontSize;
            var pushButtonSize = GUI.skin.button.fontSize;

            GUI.skin.label.fontSize  = 12;
            GUI.skin.button.fontSize = 12;

            // Enable SignalDelay
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Enable Signal Delay: ", GUILayout.Width(firstColWidth));
                int enabledSignalDelay = (settings.EnableSignalDelay) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { settings.EnableSignalDelay = true; }, enabledSignalDelay, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { settings.EnableSignalDelay = false; }, enabledSignalDelay, 0);
            }
            GUILayout.EndHorizontal();

            // Consumption Multiplier
            GUILayout.BeginHorizontal();
            {
                string label = string.Format("Consumption Multiplier: ({0})", settings.ConsumptionMultiplier);
                GUILayout.Label(label, GUILayout.Width(firstColWidth));
                settings.ConsumptionMultiplier = GUILayout.HorizontalSlider(settings.ConsumptionMultiplier, 0, 2);
            }
            GUILayout.EndHorizontal();

            // Range Multiplier
            GUILayout.BeginHorizontal();
            {
                string label = string.Format("Range Multiplier: ({0})", settings.RangeMultiplier);
                GUILayout.Label(label, GUILayout.Width(firstColWidth));
                settings.RangeMultiplier = GUILayout.HorizontalSlider(settings.RangeMultiplier, 0, 2);
            }
            GUILayout.EndHorizontal();

            // Speed of light
            GUILayout.BeginHorizontal();
            {
                string label = string.Format("Speed of light: ({0})", settings.SpeedOfLight);
                GUILayout.Label(label, GUILayout.Width(firstColWidth));
                settings.SpeedOfLight = GUILayout.HorizontalSlider(settings.SpeedOfLight, 100000, 300000000);
            }
            GUILayout.EndHorizontal();

            // ThrottleTimeWarp
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Throttle TimeWarp: ", GUILayout.Width(firstColWidth));
                int throttleTimeWarp = (settings.ThrottleTimeWarp) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { settings.ThrottleTimeWarp = true; }, throttleTimeWarp, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { settings.ThrottleTimeWarp = false; }, throttleTimeWarp, 0);
            }
            GUILayout.EndHorizontal();

            // HideGroundStationsBehindBody
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Hide Station behind body: ", GUILayout.Width(firstColWidth));
                int hideGroundStationsBehindBody = (settings.HideGroundStationsBehindBody) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { settings.HideGroundStationsBehindBody = true; }, hideGroundStationsBehindBody, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { settings.HideGroundStationsBehindBody = false; }, hideGroundStationsBehindBody, 0);
            }
            GUILayout.EndHorizontal();


            GUILayout.Space(10);
            GUILayout.Label("Cheat options");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Signal through bodys: ", GUILayout.Width(firstColWidth));
                int cheatEVAFuel = (CheatOptions.InfiniteEVAFuel) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfiniteEVAFuel = true; }, cheatEVAFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfiniteEVAFuel = false; }, cheatEVAFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Infinite Fuel: ", GUILayout.Width(firstColWidth));
                int cheatinfiniteFuel = (CheatOptions.InfiniteFuel) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfiniteFuel = true; }, cheatinfiniteFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfiniteFuel = false; }, cheatinfiniteFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Infinite RCS Fuel: ", GUILayout.Width(firstColWidth));
                int cheatinfiniteRCSFuel = (CheatOptions.InfiniteRCS) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfiniteRCS = true; }, cheatinfiniteRCSFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfiniteRCS = false; }, cheatinfiniteRCSFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUI.skin.label.fontSize  = pushLabelSize;
            GUI.skin.button.fontSize = pushButtonSize;
        }
Example #12
0
        public void Draw()
        {
            float width3 = 156 / 3 - GUI.skin.button.margin.right * 2.0f / 3.0f;

            if (Event.current.Equals(Event.KeyboardEvent("return")))
            {
                if (GUI.GetNameOfFocusedControl().StartsWith("rt_phr"))
                {
                    mPitch   = Pitch.ToString();
                    mHeading = Heading.ToString();
                    mRoll    = Roll.ToString();
                    if (mFlightComputer.InputAllowed)
                    {
                        mMode = ComputerMode.Custom;
                        Confirm();
                    }
                }
                else if (GUI.GetNameOfFocusedControl() == "rt_burn")
                {
                    OnBurnClick();
                }
            }
            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_KILL"), Localizer.Format("#RT_AttitudeFragment_KILL_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Kill)), (int)mMode, (int)ComputerMode.Kill, GUILayout.Width(width3));           //"KILL", "Kill rotation."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_NODE"), Localizer.Format("#RT_AttitudeFragment_NODE_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Node)), (int)mMode, (int)ComputerMode.Node, GUILayout.Width(width3));           //"NODE", "Prograde points in the direction of the first maneuver node."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_RVEL"), Localizer.Format("#RT_AttitudeFragment_RVEL_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.TargetVel)), (int)mMode, (int)ComputerMode.TargetVel, GUILayout.Width(width3)); //"RVEL", "Prograde relative to target velocity."
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_ORB"), Localizer.Format("#RT_AttitudeFragment_ORB_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Orbital)), (int)mMode, (int)ComputerMode.Orbital, GUILayout.Width(width3));     //"ORB", "Prograde relative to orbital velocity."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_SRF"), Localizer.Format("#RT_AttitudeFragment_SRF_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Surface)), (int)mMode, (int)ComputerMode.Surface, GUILayout.Width(width3));     //"SRF", "Prograde relative to surface velocity."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_TGT"), Localizer.Format("#RT_AttitudeFragment_TGT_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.TargetPos)), (int)mMode, (int)ComputerMode.TargetPos, GUILayout.Width(width3)); //"TGT", "Prograde points directly at target."
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_OFF"), Localizer.Format("#RT_AttitudeFragment_OFF_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Off)), (int)mMode, (int)ComputerMode.Off, GUILayout.Width(width3));                 //"OFF", "Set Attitude to Off."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_CUSTOM"), Localizer.Format("#RT_AttitudeFragment_CUSTOM_desc")), () => RTCore.Instance.StartCoroutine(OnModeClick(ComputerMode.Custom)), (int)mMode, (int)ComputerMode.Custom, GUILayout.ExpandWidth(true)); //"CUSTOM", "Prograde fixed as pitch, heading, roll relative to north pole."
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(5);

                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_Prograde"), Localizer.Format("#RT_AttitudeFragment_Prograde_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.Prograde)), (int)mAttitude, (int)FlightAttitude.Prograde, GUILayout.Width(width3));         //"GRD\n+", "Orient to Prograde."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_RadialPlus"), Localizer.Format("#RT_AttitudeFragment_RadialPlus_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.RadialPlus)), (int)mAttitude, (int)FlightAttitude.RadialPlus, GUILayout.Width(width3)); //"RAD\n+", "Orient to Radial."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_NormalPlus"), Localizer.Format("#RT_AttitudeFragment_NormalPlus_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.NormalPlus)), (int)mAttitude, (int)FlightAttitude.NormalPlus, GUILayout.Width(width3)); //"NRM\n+", "Orient to Normal."
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_Retrograde"), Localizer.Format("#RT_AttitudeFragment_Retrograde_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.Retrograde)), (int)mAttitude, (int)FlightAttitude.Retrograde, GUILayout.Width(width3));     //"GRD\n-", "Orient to Retrograde."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_RadialMinus"), Localizer.Format("#RT_AttitudeFragment_RadialMinus_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.RadialMinus)), (int)mAttitude, (int)FlightAttitude.RadialMinus, GUILayout.Width(width3)); //"RAD\n-", "Orient to Anti-radial."
                    RTUtil.FakeStateButton(new GUIContent(Localizer.Format("#RT_AttitudeFragment_NormalMinus"), Localizer.Format("#RT_AttitudeFragment_NormalMinus_desc")), () => RTCore.Instance.StartCoroutine(OnAttitudeClick(FlightAttitude.NormalMinus)), (int)mAttitude, (int)FlightAttitude.NormalMinus, GUILayout.Width(width3)); //"NRM\n-", "Orient to Anti-normal."
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(5);

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(new GUIContent(Localizer.Format("#RT_AttitudeFragment_PIT"), Localizer.Format("#RT_AttitudeFragment_PIT_desc")), GUILayout.Width(width3));//"PIT:", "Sets pitch."
                    RTUtil.RepeatButton("+", () => { Pitch++; });
                    RTUtil.RepeatButton("-", () => { Pitch--; });
                    RTUtil.MouseWheelTriggerField(ref mPitch, "rt_phr1", () => { Pitch++; }, () => { Pitch--; }, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(new GUIContent(Localizer.Format("#RT_AttitudeFragment_HDG"), Localizer.Format("#RT_AttitudeFragment_HDG_desc")), GUILayout.Width(width3));//"HDG:", "Sets heading."
                    RTUtil.RepeatButton("+", () => { Heading++; });
                    RTUtil.RepeatButton("-", () => { Heading--; });
                    RTUtil.MouseWheelTriggerField(ref mHeading, "rt_phr2", () => { Heading++; }, () => { Heading--; }, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(new GUIContent(Localizer.Format("#RT_AttitudeFragment_RLL"), Localizer.Format("#RT_AttitudeFragment_RLL_desc")), GUILayout.Width(width3));//"RLL:", "Sets roll."
                    RTUtil.RepeatButton("+", () => { Roll++; });
                    RTUtil.RepeatButton("-", () => { Roll--; });
                    RTUtil.MouseWheelTriggerField(ref mRoll, "rt_phr3", () => { Roll++; }, () => { Roll--; }, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(Localizer.Format("#RT_AttitudeFragment_Throttle"));//"Throttle: "
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(mThrottle.ToString("P"));
                }
                GUILayout.EndHorizontal();

                RTUtil.HorizontalSlider(ref mThrottle, 0, 1);
                GUI.SetNextControlName("rt_burn");
                RTUtil.TextField(ref mDuration);

                GUILayout.BeginHorizontal();
                {
                    RTUtil.Button(new GUIContent(Localizer.Format("#RT_AttitudeFragment_BURN"), Localizer.Format("#RT_AttitudeFragment_BURN_desc")), //"BURN", "Example: 125, 125s, 5m20s, 1d6h20m10s, 123m/s."
                                  OnBurnClick, GUILayout.Width(width3));
                    RTUtil.Button(new GUIContent(Localizer.Format("#RT_AttitudeFragment_EXEC"), Localizer.Format("#RT_AttitudeFragment_EXEC_desc")), //"EXEC", "Executes next and subsequent maneuver nodes."
                                  OnExecClick, GUILayout.Width(width3));
                    RTUtil.Button(new GUIContent(">>", Localizer.Format("#RT_AttitudeFragment_Queue_desc")),                                         //"Toggles the queue and delay functionality."
                                  mOnClickQueue, GUILayout.Width(width3));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Example #13
0
        /// <summary>
        /// Draws the RTSettings section
        /// </summary>
        private void drawRTSettingsTab()
        {
            var settings      = RTSettings.Instance;
            int firstColWidth = 250;

            var pushLabelSize  = GUI.skin.label.fontSize;
            var pushButtonSize = GUI.skin.button.fontSize;

            GUI.skin.label.fontSize  = 12;
            GUI.skin.button.fontSize = 12;

            // Deaktivate Mission Control
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Deactivate KSC: ", GUILayout.Width(firstColWidth));
                RTUtil.FakeStateButton(new GUIContent("On"), () => { foreach (MissionControlSatellite mcs in settings.GroundStations)
                                                                     {
                                                                         mcs.togglePower(false);
                                                                     }
                                                                     ; deactivatedMissionControls = 1; }, deactivatedMissionControls, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { foreach (MissionControlSatellite mcs in settings.GroundStations)
                                                                      {
                                                                          mcs.togglePower(true);
                                                                      }
                                                                      ; deactivatedMissionControls = 0; }, deactivatedMissionControls, 0);
            }
            GUILayout.EndHorizontal();


            GUILayout.Space(10);
            GUILayout.Label("Cheat options");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Signal through bodys: ", GUILayout.Width(firstColWidth));
                int cheatEVAFuel = (CheatOptions.InfinitePropellant) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfinitePropellant = true; }, cheatEVAFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfinitePropellant = false; }, cheatEVAFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Infinite Fuel: ", GUILayout.Width(firstColWidth));
                int cheatinfiniteFuel = (CheatOptions.InfinitePropellant) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfinitePropellant = true; }, cheatinfiniteFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfinitePropellant = false; }, cheatinfiniteFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Infinite RCS Fuel: ", GUILayout.Width(firstColWidth));
                int cheatinfiniteRCSFuel = (CheatOptions.InfinitePropellant) ? 1 : 0;
                RTUtil.FakeStateButton(new GUIContent("On"), () => { CheatOptions.InfinitePropellant = true; }, cheatinfiniteRCSFuel, 1);
                RTUtil.FakeStateButton(new GUIContent("Off"), () => { CheatOptions.InfinitePropellant = false; }, cheatinfiniteRCSFuel, 0);
            }
            GUILayout.EndHorizontal();

            GUI.skin.label.fontSize  = pushLabelSize;
            GUI.skin.button.fontSize = pushButtonSize;
        }