protected void apply(Action <ModuleTCA> action) { if (SQD == null) { action(TCA); } else { SQD.Apply(action); } }
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); }