コード例 #1
0
 static void onToolbarToggle(ClickEvent e)
 {
     if (TCA != null)
     {
         TCAGui.Toggle();
     }
     else if (HighLogic.LoadedSceneIsEditor && EnginesProfileEditor.Available)
     {
         EnginesProfileEditor.Toggle();
     }
     else
     {
         TCAManual.Toggle();
     }
 }
コード例 #2
0
 void DrawMainWindow(int windowID)
 {
     //help button
     if (GUI.Button(new Rect(WindowPos.width - 23f, 2f, 20f, 18f),
                    new GUIContent("?", "Help")))
     {
         TCAManual.Toggle();
     }
     GUILayout.BeginVertical();
     if (HasMacroProcessor)
     {
         if (TCAMacroEditor.Editing)
         {
             GUILayout.Label("Edit Macros", Styles.inactive_button, GUILayout.ExpandWidth(true));
         }
         else if (GUILayout.Button("Edit Macros", Styles.normal_button, GUILayout.ExpandWidth(true)))
         {
             TCAMacroEditor.Edit(CFG);
         }
     }
     GUILayout.BeginHorizontal();
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     Utils.ButtonSwitch("Enable TCA", ref CFG.Enabled, "", GUILayout.ExpandWidth(false));
     if (HasAltitudeControl)
     {
         if (Utils.ButtonSwitch("Hover", CFG.VF[VFlight.AltitudeControl],
                                "Enable Altitude Control", GUILayout.ExpandWidth(false)))
         {
             CFG.VF.Toggle(VFlight.AltitudeControl);
         }
         Utils.ButtonSwitch("Follow Terrain", ref CFG.AltitudeAboveTerrain,
                            "Enable follow terrain mode", GUILayout.ExpandWidth(false));
         Utils.ButtonSwitch("AutoThrottle", ref CFG.BlockThrottle,
                            "Change altitude/vertical velocity using main throttle control", GUILayout.ExpandWidth(false));
     }
     if (HasVTOLControls)
     {
         if (Utils.ButtonSwitch("VTOL Mode", CFG.CTRL[ControlMode.VTOL],
                                "Keyboard controls thrust direction instead of torque", GUILayout.ExpandWidth(false)))
         {
             CFG.CTRL.XToggle(ControlMode.VTOL);
         }
     }
     if (HasVTOLAssist)
     {
         Utils.ButtonSwitch("VTOL Assist", ref CFG.VTOLAssistON,
                            "Automatic assistnce with vertical takeof or landing", GUILayout.ExpandWidth(false));
     }
     if (HasFlightStabilizer)
     {
         Utils.ButtonSwitch("Flight Stabilizer", ref CFG.StabilizeFlight,
                            "Automatic flight stabilization when vessel is out of control", GUILayout.ExpandWidth(false));
     }
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     Utils.ButtonSwitch("AutoGear", ref CFG.AutoGear,
                        "Automatically deploy/retract landing gear when needed", GUILayout.ExpandWidth(true));
     Utils.ButtonSwitch("AutoBrakes", ref CFG.AutoBrakes,
                        "Automatically ebable/disable brakes when needed", GUILayout.ExpandWidth(true));
     Utils.ButtonSwitch("AutoStage", ref CFG.AutoStage,
                        "Automatically activate next stage when previous falmeouted", GUILayout.ExpandWidth(true));
     Utils.ButtonSwitch("AutoChute", ref CFG.AutoParachutes,
                        "Automatically activate parachutes when needed", GUILayout.ExpandWidth(true));
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     CFG.EnginesProfiles.Draw(height);
     if (CFG.ActiveProfile.Changed)
     {
         CFG.ActiveProfile.Apply(Engines);
         update_engines = true;
     }
     GUILayout.BeginHorizontal(Styles.white);
     GUILayout.Label("Ship Info:");
     GUILayout.FlexibleSpace();
     GUILayout.Label(string.Format("Mass: {0} ► {1}", Utils.formatMass(Mass), Utils.formatMass(DryMass)), Styles.boxed_label);
     GUILayout.Label(string.Format("TWR: {0:F2} ► {1:F2}", MinTWR, MaxTWR), Styles.boxed_label);
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
     TooltipsAndDragWindow(WindowPos);
 }
コード例 #3
0
        void DrawMainWindow(int windowID)
        {
            //help button
            if (GUI.Button(new Rect(WindowPos.width - 23f, 2f, 20f, 18f),
                           new GUIContent("?", "Help")))
            {
                TCAManual.Toggle();
            }
            if (TCA.Controllable)
            {
                //options button
                if (GUI.Button(new Rect(2f, 2f, 70f, 18f),
                               new GUIContent("advanced", "Advanced configuration"),
                               adv_options? Styles.enabled_button : Styles.normal_button))
                {
                    adv_options = !adv_options;
                }
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                //tca toggle
                var enabled_style = Styles.inactive_button;
                if (CFG.Enabled)
                {
                    enabled_style = Styles.enabled_button;
                }
                else if (!VSL.LandedOrSplashed)
                {
                    if (EnabledBlinker.On)
                    {
                        enabled_style = Styles.danger_button;
                    }
                    Status(0.1, "red", "<b>TCA is disabled</b>");
                }
                if (GUILayout.Button("Enabled", enabled_style, GUILayout.Width(70)))
                {
                    if (SQD == null)
                    {
                        TCA.ToggleTCA();
                    }
                    else
                    {
                        SQD.Apply(tca => tca.ToggleTCA());
                    }
                }
                //squad mode switch
                SquadControls.Draw();
                GUILayout.FlexibleSpace();
                StatusString();
                GUILayout.EndHorizontal();
                SelectConfig_start();
                AdvancedOptions();
                AttitudeControls.Draw();
                InOrbitControls.Draw();
                OnPlanetControls.Draw();
                NavigationControls.Draw();
                MacroControls.Draw();
                NavigationControls.WaypointList();
                EnginesControl();
                                #if DEBUG
                DebugInfo();
//				EnginesInfo();
                                #endif
                if (!string.IsNullOrEmpty(StatusMessage))
                {
                    if (GUILayout.Button(new GUIContent(StatusMessage, "Click to dismiss"),
                                         Styles.boxed_label, GUILayout.ExpandWidth(true)) ||
                        StatusEndTime > DateTime.MinValue && DateTime.Now > StatusEndTime)
                    {
                        StatusMessage = "";
                    }
                }
                SelectConfig_end();
                GUILayout.EndVertical();
            }
            else
            {
                GUILayout.Label("Vessel is Uncontrollable", Styles.label, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            }
            TooltipsAndDragWindow(WindowPos);
        }