コード例 #1
0
        // MOARdV: Spaceplane Guidance can not be implemented cleanly, because
        // MJ's MechJebModuleSpaceplaneGuidance is missing the 'public'
        // keyword.  We could use another controller (like ourself), but that
        // means one is forced to use our menu to turn it off (the MJ GUI is
        // not able to change the setting), and vice versa.  Since every other
        // place where we interface with MJ, we use MJ's objects as the
        // controller, this breaks our design model.  If/when MJ makes the
        // module public, all of the commented code here related to it can be
        // uncommented, and this missive can be deleted.
        //private void SpaceplaneGuidance(int index, TextMenu.Item tmi)
        //{
        //	UpdateJebReferences();
        //	if (activeJeb != null) {
        //		var autopilot = activeJeb.GetComputerModule<MechJebModuleSpaceplaneAutopilot>();
        //		if (autopilot != null) {
        //			MechJebModuleSpaceplaneGuidance is not currently public.  Can't use it.
        //			var autopilotController = activeJeb.GetComputerModule<MechJebModuleSpaceplaneGuidance>();
        //			if (autopilotController != null) {
        //				if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.HOLD) {
        //					autopilot.AutopilotOff();
        //				} else if (!autopilot.enabled) {
        //					autopilot.HoldHeadingAndAltitude(autopilotController);
        //				}
        //			}
        //		}
        //	}
        //}

        private void CircularizeMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.CircularizeMenu;

            activeMenu               = new TextMenu();
            activeMenu.labelColor    = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);
            activeMenu.menuTitle     = "== Circularize Menu:";

            activeMenu.Add(new TextMenu.Item("At Next Ap", DoCircularize, (int)MechJebModuleManeuverPlanner.TimeReference.APOAPSIS));
            activeMenu.Add(new TextMenu.Item("At Next Pe", DoCircularize, (int)MechJebModuleManeuverPlanner.TimeReference.PERIAPSIS));
            activeMenu.Add(new TextMenu.Item("In 15s", DoCircularize, (int)MechJebModuleManeuverPlanner.TimeReference.X_FROM_NOW));
        }
コード例 #2
0
        private void TargetMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.TargetMenu;

            activeMenu               = new TextMenu();
            activeMenu.labelColor    = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);

            foreach (MechJebModuleSmartASS.Target target in targetTargets)
            {
                activeMenu.Add(new TextMenu.Item(MechJebModuleSmartASS.TargetTexts[(int)target].Replace('\n', ' '), SelectTarget));
            }
        }
コード例 #3
0
 public void ClickProcessor(int buttonID)
 {
     if (buttonID == buttonUp)
     {
         activeMenu.PreviousItem();
     }
     else if (buttonID == buttonDown)
     {
         activeMenu.NextItem();
     }
     else if (buttonID == buttonEnter)
     {
         activeMenu.SelectItem();
     }
     else if (buttonID == buttonEsc)
     {
         activeMenu  = topMenu;
         currentMenu = MJMenu.RootMenu;
     }
     else if (buttonID == buttonHome)
     {
         if (currentMenu == MJMenu.RootMenu && activeMenu.currentSelection == 5 && smartassAvailable)
         {
             // If Force Roll is highlighted, the Home key will increment the
             // roll value.
             double currentRoll = GetForceRollAngle() + forceRollStep;
             if (currentRoll > 180.0)
             {
                 currentRoll -= 360.0;
             }
             else if (currentRoll < -180.0)
             {
                 currentRoll += 360.0;
             }
             SetForceRoll(true, currentRoll);
             forceRollMenuItem.isSelected = true;
             //activeSmartass.rol = currentRoll;
             //if (forceRollMenuItem.isSelected)
             //{
             //    activeSmartass.Engage();
             //}
         }
     }
 }
コード例 #4
0
 public void ClickProcessor(int buttonID)
 {
     if (buttonID == buttonUp)
     {
         activeMenu.PreviousItem();
     }
     if (buttonID == buttonDown)
     {
         activeMenu.NextItem();
     }
     if (buttonID == buttonEnter)
     {
         activeMenu.SelectItem();
     }
     if (buttonID == buttonEsc)
     {
         activeMenu  = topMenu;
         currentMenu = MJMenu.RootMenu;
     }
     if (buttonID == buttonHome)
     {
         if (currentMenu == MJMenu.RootMenu && activeMenu.currentSelection == 5 && activeSmartass != null)
         {
             // If Force Roll is highlighted, the Home key will increment the
             // roll value.
             double currentRoll = (double)activeSmartass.rol + forceRollStep;
             if (currentRoll > 180.0)
             {
                 currentRoll -= 360.0;
             }
             else if (currentRoll < -180.0)
             {
                 currentRoll += 360.0;
             }
             activeSmartass.rol = currentRoll;
             if (forceRollMenuItem.isSelected)
             {
                 activeSmartass.Engage();
             }
         }
     }
 }
コード例 #5
0
        private void TargetMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.TargetMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);

            foreach (MechJebModuleSmartASS.Target target in targetTargets)
            {
                activeMenu.Add(new TextMenu.Item(MechJebModuleSmartASS.TargetTexts[(int)target].Replace('\n', ' '), SelectTarget));
            }
        }
コード例 #6
0
        // MOARdV: Spaceplane Guidance can not be implemented cleanly, because
        // MJ's MechJebModuleSpaceplaneGuidance is missing the 'public'
        // keyword.  We could use another controller (like ourself), but that
        // means one is forced to use our menu to turn it off (the MJ GUI is
        // not able to change the setting), and vice versa.  Since every other
        // place where we interface with MJ, we use MJ's objects as the
        // controller, this breaks our design model.  If/when MJ makes the
        // module public, all of the commented code here related to it can be
        // uncommented, and this missive can be deleted.
        //private void SpaceplaneGuidance(int index, TextMenu.Item tmi)
        //{
        //    UpdateJebReferences();
        //    if (activeJeb != null) {
        //        var autopilot = activeJeb.GetComputerModule<MechJebModuleSpaceplaneAutopilot>();
        //        if (autopilot != null) {
        //            MechJebModuleSpaceplaneGuidance is not currently public.  Can't use it.
        //            var autopilotController = activeJeb.GetComputerModule<MechJebModuleSpaceplaneGuidance>();
        //            if (autopilotController != null) {
        //                if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.HOLD) {
        //                    autopilot.AutopilotOff();
        //                } else if (!autopilot.enabled) {
        //                    autopilot.HoldHeadingAndAltitude(autopilotController);
        //                }
        //            }
        //        }
        //    }
        //}
        private void CircularizeMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.CircularizeMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);
            activeMenu.menuTitle = "== Circularize Menu:";

            activeMenu.Add(new TextMenu.Item("At Next Ap", DoCircularize, (int)TimeReference.APOAPSIS));
            activeMenu.Add(new TextMenu.Item("At Next Pe", DoCircularize, (int)TimeReference.PERIAPSIS));
            activeMenu.Add(new TextMenu.Item("In 15s", DoCircularize, (int)TimeReference.X_FROM_NOW));
        }
コード例 #7
0
 public void ClickProcessor(int buttonID)
 {
     if (buttonID == buttonUp)
     {
         activeMenu.PreviousItem();
     }
     if (buttonID == buttonDown)
     {
         activeMenu.NextItem();
     }
     if (buttonID == buttonEnter)
     {
         activeMenu.SelectItem();
     }
     if (buttonID == buttonEsc)
     {
         activeMenu = topMenu;
         currentMenu = MJMenu.RootMenu;
     }
     if (buttonID == buttonHome)
     {
         if (currentMenu == MJMenu.RootMenu && activeMenu.currentSelection == 5 && activeSmartass != null)
         {
             // If Force Roll is highlighted, the Home key will increment the
             // roll value.
             double currentRoll = (double)activeSmartass.rol + forceRollStep;
             if (currentRoll > 180.0)
             {
                 currentRoll -= 360.0;
             }
             else if (currentRoll < -180.0)
             {
                 currentRoll += 360.0;
             }
             activeSmartass.rol = currentRoll;
             if (forceRollMenuItem.isSelected)
             {
                 activeSmartass.Engage();
             }
         }
     }
 }
コード例 #8
0
 public void ClickProcessor(int buttonID)
 {
     if (buttonID == buttonUp)
     {
         activeMenu.PreviousItem();
     }
     else if (buttonID == buttonDown)
     {
         activeMenu.NextItem();
     }
     else if (buttonID == buttonEnter)
     {
         activeMenu.SelectItem();
     }
     else if (buttonID == buttonEsc)
     {
         activeMenu = topMenu;
         currentMenu = MJMenu.RootMenu;
     }
     else if (buttonID == buttonHome)
     {
         if (currentMenu == MJMenu.RootMenu && activeMenu.currentSelection == 5 && smartassAvailable)
         {
             // If Force Roll is highlighted, the Home key will increment the
             // roll value.
             double currentRoll = GetForceRollAngle() + forceRollStep;
             if (currentRoll > 180.0)
             {
                 currentRoll -= 360.0;
             }
             else if (currentRoll < -180.0)
             {
                 currentRoll += 360.0;
             }
             SetForceRoll(true, currentRoll);
             forceRollMenuItem.isSelected = true;
             //activeSmartass.rol = currentRoll;
             //if (forceRollMenuItem.isSelected)
             //{
             //    activeSmartass.Engage();
             //}
         }
     }
 }