public override void OnDestroy() { base.OnDestroy(); clear_fields(); TCAAppToolbar.AttachTCA(null); GameEvents.onVesselChange.Remove(onVesselChange); GameEvents.onVesselDestroy.Remove(onVesselDestroy); }
public override void Draw() { GUILayout.BeginHorizontal(); GUILayout.Label(UI.Title, Styles.label, GUILayout.ExpandWidth(true)); if (GUILayout.Button(new GUIContent("Reload", "Reload TCA settings from file"), Styles.active_button, GUILayout.ExpandWidth(true))) { Globals.Load(); TCA.OnReloadGlobals(); } GUILayout.EndHorizontal(); 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."); } if (Utils.ButtonSwitch("AutoSave", ref Globals.Instance.AutosaveBeforeLanding, "Automatically save the game before executing complex autopilot programs", GUILayout.ExpandWidth(true))) { Globals.Save(":AutosaveBeforeLanding"); } if (Utils.ButtonSwitch(Globals.Instance.UseStockAppLauncher ? "Launcher" : "Toolbar", ref Globals.Instance.UseStockAppLauncher, "Use stock AppLauncher or Toolbar plugin?", GUILayout.ExpandWidth(true))) { TCAAppToolbar.Init(); Globals.Save(":UseStockAppLauncher"); } Utils.ButtonSwitch("AutoShow", ref UI.ShowOnHover, "Show collapsed TCA window when mouse hovers over it", GUILayout.ExpandWidth(true)); if (GUILayout.Button(new GUIContent("InfoPanel", "Show test info message to change the position of the info panel"), GUILayout.ExpandWidth(true)) && string.IsNullOrEmpty(TCAGui.StatusMessage)) { Status(InfoPanel.TEST_MSG); } 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(); }
bool init() { clear_fields(); ClearStatus(); TCAAppToolbar.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); TCAAppToolbar.AttachTCA(TCA); create_fields(); if (ADV != null) { ADV.UpdateNamedConfigs(); } return(true); }