public string ShowMenu(int width, int height) { var result = new StringBuilder(); if (!string.IsNullOrEmpty(pageTitle)) { result.AppendLine(pageTitle); height--; } if (smartassAvailable) { switch (currentMenu) { case MJMenu.RootMenu: UpdateRootMenu(); break; case MJMenu.OrbitMenu: UpdateOrbitalMenu(); break; case MJMenu.SurfaceMenu: UpdateSurfaceMenu(); break; case MJMenu.TargetMenu: UpdateTargetMenu(); break; case MJMenu.CircularizeMenu: UpdateCircularizeMenu(); break; } result.Append(activeMenu.ShowMenu(width, height)); } else { if (mjAvailable == false) { result.AppendLine("MechJeb Autopilot not found."); } else { result.AppendLine("Attitude control unavailable."); } } return(result.ToString()); }
public string ShowMenu(int width, int height) { var result = new StringBuilder(); if (!string.IsNullOrEmpty(pageTitle)) { result.AppendLine(pageTitle); height--; } topMenu[0].isSelected = vessel.ActionGroups.groups[sasGroupNumber]; topMenu[0].labelText = (vessel.ActionGroups.groups[sasGroupNumber]) ? "Disable SAS" : "Enable SAS"; for (int i = 1; i < topMenu.Count; ++i) { if (vessel.Autopilot.CanSetMode(modes[i])) { topMenu[i].isDisabled = false; topMenu[i].isSelected = (vessel.Autopilot.Mode == modes[i]); if (topMenu[i].isSelected) { activeMode = i; } } else { topMenu[i].isDisabled = true; topMenu[i].isSelected = false; } } if (vessel.ActionGroups.groups[sasGroupNumber] == false) { activeMode = 0; } topMenu.menuTitle = string.Format(fp, menuTitleFormatString, modeStrings[activeMode]); result.Append(topMenu.ShowMenu(width, height)); return(result.ToString()); }