Beispiel #1
0
 public override void OnDestroy()
 {
     base.OnDestroy();
     clear_fields();
     TCAToolbarManager.AttachTCA(null);
     GameEvents.onGameStateSave.Remove(save_config);
     GameEvents.onVesselChange.Remove(onVesselChange);
 }
 void Awake()
 {
     if (Instance != null)
     {
         return;
     }
     DontDestroyOnLoad(this);
     Instance = this;
     init();
 }
 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
 }
Beispiel #4
0
 static bool init()
 {
     clear_fields();
     TCAToolbarManager.AttachTCA(null);
     TCA = ModuleTCA.AvailableTCA(vessel);
     if (TCA == null)
     {
         return(false);
     }
     if (CFG != null)
     {
         window_enabled = CFG.GUIVisible;
     }
     TCAToolbarManager.AttachTCA(TCA);
     create_fields();
     update_configs();
     return(true);
 }
Beispiel #5
0
 bool init()
 {
     clear_fields();
     TCAToolbarManager.AttachTCA(null);
     TCA = ModuleTCA.AvailableTCA(vessel);
     if (TCA == null || CFG == null)
     {
         return(false);
     }
     ShowInstance(CFG.GUIVisible);
     ModulesGraph.SetCFG(CFG);
     TCAToolbarManager.AttachTCA(TCA);
     create_fields();
     if (ADV != null)
     {
         ADV.UpdateNamedConfigs();
     }
     return(true);
 }
Beispiel #6
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();
 }
 bool init()
 {
     clear_fields();
     ClearStatus();
     TCAToolbarManager.AttachTCA(null);
     TCA = ModuleTCA.AvailableTCA(vessel);
     if (TCA == null || CFG == null)
     {
         return(false);
     }
     ActiveVesselTCA   = ModuleTCA.AvailableTCA(FlightGlobals.ActiveVessel);
     HaveRemoteControl = ActiveVesselTCA != null && ActiveVesselTCA.GetModule <SquadControl>() != null;
     RemoteControl     = ActiveVesselTCA != TCA;
     ShowInstance(CFG.GUIVisible);
     ModulesGraph.SetCFG(CFG);
     TCAToolbarManager.AttachTCA(TCA);
     create_fields();
     if (ADV != null)
     {
         ADV.UpdateNamedConfigs();
     }
     return(true);
 }
 void Awake()
 {
     if(Instance != null) return;
     DontDestroyOnLoad(this);
     Instance = this;
     init();
 }