public override void Draw()
 {
     GUILayout.Label(UI.Title, Styles.label, GUILayout.ExpandWidth(true));
     GUILayout.BeginHorizontal();
     //change key binding
     if (GUILayout.Button(SelectingKey? new GUIContent("HotKey: ?", "Choose new TCA hotkey") :
                          new GUIContent(string.Format("HotKey: {0}", UI.TCA_Key), "Select TCA Hotkey"),
                          SelectingKey? Styles.enabled_button : Styles.active_button,
                          GUILayout.ExpandWidth(true)))
     {
         SelectingKey = true;
         Utils.Message("Press a key that will toggle TCA.\n" +
                       "Press BACKSPACE to remove TCA hotkey.\n" +
                       "Press ESCAPE to cancel.");
     }
     Utils.ButtonSwitch("Autosave", ref Globals.Instance.AutosaveBeforeLanding,
                        "Automatically save the game before executing complex autopilot programs",
                        GUILayout.ExpandWidth(true));
     if (Utils.ButtonSwitch(Globals.Instance.UseStockAppLauncher? "Launcher" : "Toolbar",
                            ref Globals.Instance.UseStockAppLauncher,
                            "Use stock AppLauncher or Toolbar plugin?",
                            GUILayout.ExpandWidth(true)))
     {
         TCAToolbarManager.Init();
     }
     if (GUILayout.Button(new GUIContent("Reload", "Reload TCA settings from file"),
                          Styles.active_button, GUILayout.ExpandWidth(true)))
     {
         Globals.Load();
         Styles.ConfigureButtons();
         TCA.OnReloadGlobals();
     }
     if (GUILayout.Button(new GUIContent("Modules", "Show TCA modules installed on this ship"),
                          Styles.active_button, GUILayout.ExpandWidth(true)))
     {
         UI.ModulesGraph.Toggle();
     }
     GUILayout.EndHorizontal();
     Toggles();
     if (THR != null)
     {
         GUILayout.BeginHorizontal();
         CFG.ControlSensitivity = Utils.FloatSlider("Keyboard sensitivity", CFG.ControlSensitivity, 0.001f, 0.05f, "P2");
         GUILayout.EndHorizontal();
     }
     ControllerProperties();
     ConfigsGUI();
     #if DEBUG
     GUILayout.Space(10);
     TCA.TEST.Draw();
     #endif
 }
Exemplo n.º 2
0
 void AdvancedOptions()
 {
     if (!adv_options)
     {
         return;
     }
     GUILayout.BeginVertical(Styles.white);
     GUILayout.Label(Title, Styles.label, GUILayout.ExpandWidth(true));
     GUILayout.BeginHorizontal();
     //change key binding
     if (GUILayout.Button(selecting_key? new GUIContent("Change TCA hotkey: ?", "Choose new TCA hotkey") :
                          new GUIContent(string.Format("Change TCA hotkey: {0}", TCA_Key), "Select TCA Hotkey"),
                          selecting_key? Styles.enabled_button : Styles.active_button,
                          GUILayout.ExpandWidth(true)))
     {
         selecting_key = true; Utils.Message("Press a key that will toggle TCA");
     }
     Utils.ButtonSwitch("Autosave on landing", ref Globals.Instance.AutosaveBeforeLanding);
     if (Utils.ButtonSwitch("Use Stock Toolbar", ref Globals.Instance.UseStockAppLauncher))
     {
         TCAToolbarManager.Init();
     }
     if (GUILayout.Button("Reload TCA Settings", Styles.active_button, GUILayout.ExpandWidth(true)))
     {
         Globals.Load();
         Styles.ConfigureButtons();
         TCA.OnReloadGlobals();
     }
     GUILayout.EndHorizontal();
     Toggles.Draw();
     if (THR != null)
     {
         GUILayout.BeginHorizontal();
         CFG.ControlSensitivity = Utils.FloatSlider("Keyboard controls sensitivity", CFG.ControlSensitivity, 0.001f, 0.05f, "P2");
         GUILayout.EndHorizontal();
     }
     ControllerProperties();
     ConfigsGUI();
     GUILayout.EndVertical();
 }
 void DrawMainWindow(int windowID)
 {
     //help button
     if (GUI.Button(new Rect(0, 0f, 20f, 18f),
                    Collapsed? uncollapse_button : collapse_button, Styles.label))
     {
         Collapsed = !Collapsed;
         update_collapsed_rect();
     }
     if (GUI.Button(new Rect(WindowPos.width - 20f, 0f, 20f, 18f),
                    new GUIContent("?", "Help"), Styles.label))
     {
         TCAManual.ToggleInstance();
     }
     //vessel switching
     if (HaveRemoteControl)
     {
         if (GUI.Button(new Rect(22, 0f, 20f, 18f), prev_vessel_button, Styles.label))
         {
             switch_vessel(FlightGlobals.Vessels.Next);
         }
         if (RemoteControl &&
             GUI.Button(new Rect(44, 0f, 20f, 18f), active_vessel_button, Styles.label))
         {
             onVesselChange(ActiveVesselTCA.vessel);
         }
         if (RemoteControl &&
             GUI.Button(new Rect(WindowPos.width - 64f, 0f, 20f, 18f), switch_vessel_button, Styles.label))
         {
             FlightGlobals.SetActiveVessel(vessel);
         }
         if (GUI.Button(new Rect(WindowPos.width - 42f, 0f, 20f, 18f), next_vessel_button, Styles.label))
         {
             switch_vessel(FlightGlobals.Vessels.Prev);
         }
     }
     if (TCA.IsControllable)
     {
         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)))
         {
             TCA.ToggleTCA();
         }
                         #if DEBUG
         if (GUILayout.Button("ReGlobals", Styles.active_button, GUILayout.ExpandWidth(false)))
         {
             Globals.Load();
             Styles.ConfigureButtons();
             TCA.OnReloadGlobals();
         }
                         #endif
         //squad mode switch
         if (SQD != null)
         {
             SQD.Draw();
         }
         GUILayout.FlexibleSpace();
         StatusLabel();
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         GUILayout.BeginVertical(Styles.white, GUILayout.MinHeight(ControlsHeight), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true));
         if (ActiveTab != null)
         {
             ActiveTab.Draw();
         }
         GUILayout.EndVertical();
         tabs_scroll = GUILayout.BeginScrollView(tabs_scroll, Styles.white, GUILayout.ExpandHeight(true), GUILayout.Width(55));
         for (int i = 0, AllTabsCount = AllTabs.Count; i < AllTabsCount; i++)
         {
             var t = AllTabs[i];
             if (t.DrawTabButton(t == ActiveTab))
             {
                 ActiveTab     = t;
                 CFG.ActiveTab = i;
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndHorizontal();
         DrawStatusMessage();
         GUILayout.EndVertical();
     }
     else
     {
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         VSL.Info.Draw();
         GUILayout.FlexibleSpace();
         StatusLabel();
         GUILayout.EndHorizontal();
         GUILayout.Label("Vessel is Uncontrollable", Styles.label, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
         DrawStatusMessage();
         GUILayout.EndVertical();
     }
     TooltipsAndDragWindow();
 }