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 (JSIMechJeb.Target target in targetTargets) { activeMenu.Add(new TextMenu.Item(JSIMechJeb.TargetTexts[(int)target].Replace('\n', ' '), SelectTarget)); } }
private void ShowFiltersMenu(int index, TextMenu.Item ti) { currentMenu = MenuList.Filters; activeMenu = new TextMenu(); activeMenu.labelColor = nameColorTag; activeMenu.selectedColor = selectedColorTag; activeMenu.disabledColor = unavailableColorTag; activeMenu.rightTextColor = distanceColorTag; for (int i = 0; i < vesselFilter.Count; i++) { var filter = vesselFilter.ElementAt(i); var tmi = new TextMenu.Item(); tmi.labelText = filter.Key.ToString().PadRight(9) + (filter.Value ? "- On" : "- Off"); tmi.isSelected = filter.Value; tmi.action = ToggleFilter; activeMenu.Add(tmi); } }
public void Start() { if (!JSI.InstallationPathWarning.Warn()) { return; } if (!string.IsNullOrEmpty(itemColor)) { itemColorValue = ConfigNode.ParseColor32(itemColor); } if (!string.IsNullOrEmpty(selectedColor)) { selectedColorValue = ConfigNode.ParseColor32(selectedColor); } if (!string.IsNullOrEmpty(unavailableColor)) { unavailableColorValue = ConfigNode.ParseColor32(unavailableColor); } topMenu.menuTitle = "== SAS Menu =="; topMenu.labelColor = JUtil.ColorToColorTag(itemColorValue); topMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue); topMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue); topMenu.Add(new TextMenu.Item("SAS Off", SAS_Toggle, 0)); topMenu.Add(new TextMenu.Item("Stability Assist", SAS_Mode, 1)); topMenu.Add(new TextMenu.Item("Maneuver Node", SAS_Mode, 2)); topMenu.Add(new TextMenu.Item("Prograde", SAS_Mode, 3)); topMenu.Add(new TextMenu.Item("Retrograde", SAS_Mode, 4)); topMenu.Add(new TextMenu.Item("Radial In", SAS_Mode, 5)); topMenu.Add(new TextMenu.Item("Radial Out", SAS_Mode, 6)); topMenu.Add(new TextMenu.Item("Normal", SAS_Mode, 7)); topMenu.Add(new TextMenu.Item("Antinormal", SAS_Mode, 8)); topMenu.Add(new TextMenu.Item("Target", SAS_Mode, 9)); topMenu.Add(new TextMenu.Item("Antitarget", SAS_Mode, 10)); }
public void Start() { // I guess I shouldn't have expected Squad to actually do something nice for a modder like that. // In 0.23, loading in non-alphabetical order is still broken. // But now we have KSPAssembly and KSPAssemblyDependency, which actually sidestep the issue, and finally // Mu told someone about it and now I can avoid this path hardlinking. // Actually, better yet. Let it check for the new canonical location instead. Because f**k installation problems. if (!JSI.InstallationPathWarning.Warn()) { return; } GameEvents.onUndock.Add(UndockCallback); if (!string.IsNullOrEmpty(itemColor)) { itemColorValue = ConfigNode.ParseColor32(itemColor); } if (!string.IsNullOrEmpty(selectedColor)) { selectedColorValue = ConfigNode.ParseColor32(selectedColor); } if (!string.IsNullOrEmpty(unavailableColor)) { unavailableColorValue = ConfigNode.ParseColor32(unavailableColor); } topMenu.labelColor = JUtil.ColorToColorTag(itemColorValue); topMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue); topMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue); RasterPropMonitorComputer rpmComp = RasterPropMonitorComputer.Instantiate(internalProp, true); Func <bool> isMjAvailable = (Func <bool>)rpmComp.GetMethod("JSIMechJeb:GetMechJebAvailable", internalProp, typeof(Func <bool>)); if (isMjAvailable == null) { throw new NotImplementedException("isMjAvailable"); } UpdateMethods(rpmComp); // If MechJeb is installed, but not found on the craft, menu options can't be populated correctly. if (isMjAvailable()) { mjAvailable = true; smartassAvailable = GetModuleExists("MechJebModuleSmartASS"); topMenu.Add(new TextMenu.Item(JSIMechJeb.TargetTexts[(int)JSIMechJeb.Target.OFF], SmartASS_Off)); topMenu.Add(new TextMenu.Item(JSIMechJeb.TargetTexts[(int)JSIMechJeb.Target.KILLROT].Replace('\n', ' '), SmartASS_KillRot)); nodeMenuItem = new TextMenu.Item(JSIMechJeb.TargetTexts[(int)JSIMechJeb.Target.NODE], SmartASS_Node); topMenu.Add(nodeMenuItem); topMenu.Add(new TextMenu.Item(JSIMechJeb.ModeTexts[(int)JSIMechJeb.Mode.ORBITAL], OrbitalMenu)); topMenu.Add(new TextMenu.Item(JSIMechJeb.ModeTexts[(int)JSIMechJeb.Mode.SURFACE], SurfaceMenu)); targetMenuItem = new TextMenu.Item(JSIMechJeb.ModeTexts[(int)JSIMechJeb.Mode.TARGET], TargetMenu); topMenu.Add(targetMenuItem); forceRollMenuItem = new TextMenu.Item(String.Format("Force Roll: {0:f0}", GetForceRollAngle()), ToggleForceRoll); topMenu.Add(forceRollMenuItem); topMenu.Add(new TextMenu.Item("Execute Next Node", ExecuteNode, (int)MJMenu.ExecuteNodeMenu)); topMenu.Add(new TextMenu.Item("Ascent Guidance", AscentGuidance, (int)MJMenu.AscentGuidanceMenu)); topMenu.Add(new TextMenu.Item("Land Somewhere", LandingGuidance, (int)MJMenu.LandingGuidanceMenu)); topMenu.Add(new TextMenu.Item("Docking Guidance", DockingGuidance, (int)MJMenu.DockingGuidanceMenu)); //topMenu.Add(new TextMenu.Item("Hold Alt & Heading", SpaceplaneGuidance, (int)MJMenu.SpacePlaneMenu)); topMenu.Add(new TextMenu.Item("Circularize", CircularizeMenu, (int)MJMenu.CircularizeMenu)); } else { mjAvailable = false; smartassAvailable = false; } activeMenu = topMenu; }