public VViewCustomMenusMenu(string name, VesselViewer shackledInstance) { this.rootMenu = null; this.name = name; instanceList.Add(this); instance = shackledInstance; }
public static void registerMenu(Func <IVViewMenu> createInstance) { foreach (VViewCustomMenusMenu instance in instanceList) { IVViewMenu customMenu = createInstance(); instance.menuList.Add(customMenu); customMenu.setRoot(instance); } menuMakerList.Add(createInstance); }
public IVViewMenu click() { if (menuList.Count == 0) { return(null); } else { IVViewMenu menu = menuList.ElementAt(activeItemPos); MonoBehaviour.print("Switching VV to custom mode " + menu.getCustomSettings().name); instance.setCustomMode(menu.getCustomSettings()); return(menu); } }
public void ButtonProcessor(int buttonID) { if (buttonID == buttonUp) { activeMenu.up(); } if (buttonID == buttonDown) { activeMenu.down(); } if (buttonID == buttonEnter) { //returns a menu to change to or null IVViewMenu returnMenu = activeMenu.click(); if (returnMenu != null) { activeMenu.deactivate(); activeMenu = returnMenu; activeMenu.activate(); } } if (buttonID == buttonEsc) { IVViewMenu returnMenu = activeMenu.back(); if (returnMenu != null) { activeMenu.deactivate(); activeMenu = returnMenu; activeMenu.activate(); } } if (buttonID == buttonHome) { } forceRedraw = true; }
public IVViewMenu update(Vessel ship) { instance.setCustomMode(null); if (menuMakerList.Count != menuList.Count) { foreach (IVViewMenu menu in menuList) { menu.setRoot(null); } menuList.Clear(); foreach (Func <IVViewMenu> createInstance in menuMakerList) { IVViewMenu newMenu = createInstance(); menuList.Add(newMenu); newMenu.setRoot(this); } return(this); } else { return(null); } }
public string ShowMenu(int width, int height) { //MonoBehaviour.print("text draw call"); StringBuilder builder = new StringBuilder(); builder.AppendLine(pageTitle); if (activeMenu != null) { IVViewMenu outMenu = activeMenu.update(FlightGlobals.ActiveVessel); if (outMenu == null) { activeMenu.printMenu(ref builder, width, height); } else { activeMenu = outMenu; } } //MonoBehaviour.print("text draw call done"); textChanged = true; return(builder.ToString()); }
public VViewSimpleMenu(IVVSimpleMenuItem[] items, string name) { this.rootMenu = null; this.menuItems = items; this.name = name; }
public VViewSimpleCustomMenuItem(string label, IVViewMenu menuTarget) { this.label = label; this.menuToChangeTo = menuTarget; }
public VViewSimpleMenuItem(string label, IVViewMenu menuTarget){ this.label = label; this.menuToChangeTo = menuTarget; }
public string ShowMenu(int width, int height) { //MonoBehaviour.print("text draw call"); StringBuilder builder = new StringBuilder(); builder.AppendLine(pageTitle); if (activeMenu != null) { IVViewMenu outMenu = activeMenu.update(FlightGlobals.ActiveVessel); if (outMenu == null) activeMenu.printMenu(ref builder, width, height); else activeMenu = outMenu; } //MonoBehaviour.print("text draw call done"); textChanged = true; return builder.ToString(); }
private void setupMenus() { //well I was gonna have to hardcode this SOMEWHERE. List<IVVSimpleMenuItem> itemList = new List<IVVSimpleMenuItem>(); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "drawPlane")); for (int i = 0; i < ViewerConstants.PLANES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.PLANES[i], settings, "drawPlane", "", i, false)); } VViewSimpleMenu orientationMENU = new VViewSimpleMenu(itemList.ToArray(), "Vessel orientation"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Up", settings, "scrOffY", "", 128, true)); itemList.Add(new VViewSimpleMenuItem("Down", settings, "scrOffY", "", -128, true)); itemList.Add(new VViewSimpleMenuItem("Left", settings, "scrOffX", "", 128, true)); itemList.Add(new VViewSimpleMenuItem("Right", settings, "scrOffX", "", -128, true)); VViewSimpleMenu manualMoveMENU = new VViewSimpleMenu(itemList.ToArray(), "Manual repositioning"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Autocentering:", settings, "autoCenter", "autoCenter")); itemList.Add(new VViewSimpleMenuItem("Hor. root center:", settings, "centerOnRootH", "centerOnRootH")); itemList.Add(new VViewSimpleMenuItem("Ver. root center:", settings, "centerOnRootV", "centerOnRootV")); itemList.Add(new VViewSimpleMenuItem("Manual repositioning", manualMoveMENU)); VViewSimpleMenu positionMENU = new VViewSimpleMenu(itemList.ToArray(), "Vessel position"); manualMoveMENU.setRoot((IVViewMenu)positionMENU); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "spinAxis")); for (int i = 0; i < ViewerConstants.AXES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.AXES[i] + " axis", settings, "spinAxis", "", i, false)); } itemList.Add(new VViewSimpleMenuItem("Rotation speed:", settings, "spinSpeed", "spinSpeed")); VViewSimpleMenu rotationMENU = new VViewSimpleMenu(itemList.ToArray(), "Display autorotation"); IVVSimpleMenuItem[] DCONItems = { new VViewSimpleMenuItem("Vessel orientation",orientationMENU), new VViewSimpleMenuItem("Vessel position",positionMENU), new VViewSimpleMenuItem("Autoscaling:",settings,"centerRescale","centerRescale"), new VViewSimpleMenuItem("Display autorotation",rotationMENU), }; VViewSimpleMenu displayConfigMENU = new VViewSimpleMenu(DCONItems, "Display configuration"); orientationMENU.setRoot((IVViewMenu)displayConfigMENU); positionMENU.setRoot((IVViewMenu)displayConfigMENU); rotationMENU.setRoot((IVViewMenu)displayConfigMENU); /***************************************************************************************************/ itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:",settings,"colorModeFillDull","colorModeFillDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeFill")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeFill", "", i, false)); } VViewSimpleMenu passiveDisplayFillMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (mesh)"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:", settings, "colorModeWireDull", "colorModeWireDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeWire")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeWire", "", i, false)); } VViewSimpleMenu passiveDisplayWireMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (wire)"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:", settings, "colorModeBoxDull", "colorModeBoxDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeBox")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeBox", "", i, false)); } VViewSimpleMenu passiveDisplayBoundsMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (bounds)"); IVVSimpleMenuItem[] PASItems = { new VViewSimpleMenuItem("Passive display (mesh)",passiveDisplayFillMENU), new VViewSimpleMenuItem("Passive display (wire)",passiveDisplayWireMENU), new VViewSimpleMenuItem("Passive display (bounds)",passiveDisplayBoundsMENU), new VViewSimpleMenuItem("Display axes:",settings,"displayAxes","displayAxes"), new VViewSimpleMenuItem("Display COM:",settings,"displayCOM","displayCOM"), new VViewSimpleMenuItem("Display engine status:",settings,"displayEngines","displayEngines"), new VViewSimpleMenuItem("Display landing assist:",settings,"displayGround","displayGround"), }; VViewSimpleMenu passiveDisplaysMENU = new VViewSimpleMenu(PASItems, "Passive display modes"); passiveDisplayFillMENU.setRoot((IVViewMenu)passiveDisplaysMENU); passiveDisplayWireMENU.setRoot((IVViewMenu)passiveDisplaysMENU); passiveDisplayBoundsMENU.setRoot((IVViewMenu)passiveDisplaysMENU); /***************************************************************************************************/ VViewCustomMenusMenu customDisplaysMENU = new VViewCustomMenusMenu("Custom display modes", viewer); /***************************************************************************************************/ IVVSimpleMenuItem[] OTHItems = { new VViewSimpleMenuItem("Latency mode:",settings,"latency","latency"), }; VViewSimpleMenu configurationMENU = new VViewSimpleMenu(OTHItems, "Other configuration"); /***************************************************************************************************/ IVVSimpleMenuItem[] MAMItems = { new VViewSimpleMenuItem("Display configuration",displayConfigMENU), new VViewSimpleMenuItem("Passive display modes",passiveDisplaysMENU), new VViewSimpleMenuItem("Custom display modes",customDisplaysMENU), new VViewSimpleMenuItem("Other configuration",configurationMENU), }; VViewSimpleMenu mainMenu = new VViewSimpleMenu(MAMItems, "Main menu"); displayConfigMENU.setRoot((IVViewMenu)mainMenu); passiveDisplaysMENU.setRoot((IVViewMenu)mainMenu); customDisplaysMENU.setRoot((IVViewMenu)mainMenu); configurationMENU.setRoot((IVViewMenu)mainMenu); IVVSimpleMenuItem[] HIDItems = { new VViewSimpleMenuItem("Show",mainMenu) }; VViewSimpleMenu hideMenu = new VViewSimpleMenu(HIDItems, "Hidden"); /*dispModeMenu.setRoot((IVViewMenu)mainMenu); */ mainMenu.setRoot((IVViewMenu)hideMenu); activeMenu = hideMenu; }
private void setupMenus() { //well I was gonna have to hardcode this SOMEWHERE. List <IVVSimpleMenuItem> itemList = new List <IVVSimpleMenuItem>(); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "drawPlane")); for (int i = 0; i < ViewerConstants.PLANES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.PLANES[i], settings, "drawPlane", "", i, false)); } VViewSimpleMenu orientationMENU = new VViewSimpleMenu(itemList.ToArray(), "Vessel orientation"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Up", settings, "scrOffY", "", 128, true)); itemList.Add(new VViewSimpleMenuItem("Down", settings, "scrOffY", "", -128, true)); itemList.Add(new VViewSimpleMenuItem("Left", settings, "scrOffX", "", 128, true)); itemList.Add(new VViewSimpleMenuItem("Right", settings, "scrOffX", "", -128, true)); VViewSimpleMenu manualMoveMENU = new VViewSimpleMenu(itemList.ToArray(), "Manual repositioning"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Autocentering:", settings, "autoCenter", "autoCenter")); itemList.Add(new VViewSimpleMenuItem("Hor. root center:", settings, "centerOnRootH", "centerOnRootH")); itemList.Add(new VViewSimpleMenuItem("Ver. root center:", settings, "centerOnRootV", "centerOnRootV")); itemList.Add(new VViewSimpleMenuItem("Manual repositioning", manualMoveMENU)); VViewSimpleMenu positionMENU = new VViewSimpleMenu(itemList.ToArray(), "Vessel position"); manualMoveMENU.setRoot((IVViewMenu)positionMENU); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "spinAxis")); for (int i = 0; i < ViewerConstants.AXES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.AXES[i] + " axis", settings, "spinAxis", "", i, false)); } itemList.Add(new VViewSimpleMenuItem("Rotation speed:", settings, "spinSpeed", "spinSpeed")); VViewSimpleMenu rotationMENU = new VViewSimpleMenu(itemList.ToArray(), "Display autorotation"); IVVSimpleMenuItem[] DCONItems = { new VViewSimpleMenuItem("Vessel orientation", orientationMENU), new VViewSimpleMenuItem("Vessel position", positionMENU), new VViewSimpleMenuItem("Autoscaling:", settings, "centerRescale","centerRescale"), new VViewSimpleMenuItem("Display autorotation", rotationMENU), }; VViewSimpleMenu displayConfigMENU = new VViewSimpleMenu(DCONItems, "Display configuration"); orientationMENU.setRoot((IVViewMenu)displayConfigMENU); positionMENU.setRoot((IVViewMenu)displayConfigMENU); rotationMENU.setRoot((IVViewMenu)displayConfigMENU); /***************************************************************************************************/ itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:", settings, "colorModeFillDull", "colorModeFillDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeFill")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeFill", "", i, false)); } VViewSimpleMenu passiveDisplayFillMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (mesh)"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:", settings, "colorModeWireDull", "colorModeWireDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeWire")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeWire", "", i, false)); } VViewSimpleMenu passiveDisplayWireMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (wire)"); itemList.Clear(); itemList.Add(new VViewSimpleMenuItem("Color dull:", settings, "colorModeBoxDull", "colorModeBoxDull")); itemList.Add(new VViewSimpleMenuItem("Active: ", settings, "", "colorModeBox")); for (int i = 0; i < ViewerConstants.COLORMODES.Length; i++) { itemList.Add(new VViewSimpleMenuItem(ViewerConstants.COLORMODES[i], settings, "colorModeBox", "", i, false)); } VViewSimpleMenu passiveDisplayBoundsMENU = new VViewSimpleMenu(itemList.ToArray(), "Passive display (bounds)"); IVVSimpleMenuItem[] PASItems = { new VViewSimpleMenuItem("Passive display (mesh)", passiveDisplayFillMENU), new VViewSimpleMenuItem("Passive display (wire)", passiveDisplayWireMENU), new VViewSimpleMenuItem("Passive display (bounds)", passiveDisplayBoundsMENU), new VViewSimpleMenuItem("Display axes:", settings, "displayAxes", "displayAxes"), new VViewSimpleMenuItem("Display COM:", settings, "displayCOM", "displayCOM"), new VViewSimpleMenuItem("Display engine status:", settings, "displayEngines", "displayEngines"), new VViewSimpleMenuItem("Display landing assist:", settings, "displayGround", "displayGround"), }; VViewSimpleMenu passiveDisplaysMENU = new VViewSimpleMenu(PASItems, "Passive display modes"); passiveDisplayFillMENU.setRoot((IVViewMenu)passiveDisplaysMENU); passiveDisplayWireMENU.setRoot((IVViewMenu)passiveDisplaysMENU); passiveDisplayBoundsMENU.setRoot((IVViewMenu)passiveDisplaysMENU); /***************************************************************************************************/ VViewCustomMenusMenu customDisplaysMENU = new VViewCustomMenusMenu("Custom display modes", viewer); /***************************************************************************************************/ IVVSimpleMenuItem[] OTHItems = { new VViewSimpleMenuItem("Latency mode:", settings, "latency", "latency"), }; VViewSimpleMenu configurationMENU = new VViewSimpleMenu(OTHItems, "Other configuration"); /***************************************************************************************************/ IVVSimpleMenuItem[] MAMItems = { new VViewSimpleMenuItem("Display configuration", displayConfigMENU), new VViewSimpleMenuItem("Passive display modes", passiveDisplaysMENU), new VViewSimpleMenuItem("Custom display modes", customDisplaysMENU), new VViewSimpleMenuItem("Other configuration", configurationMENU), }; VViewSimpleMenu mainMenu = new VViewSimpleMenu(MAMItems, "Main menu"); displayConfigMENU.setRoot((IVViewMenu)mainMenu); passiveDisplaysMENU.setRoot((IVViewMenu)mainMenu); customDisplaysMENU.setRoot((IVViewMenu)mainMenu); configurationMENU.setRoot((IVViewMenu)mainMenu); IVVSimpleMenuItem[] HIDItems = { new VViewSimpleMenuItem("Show", mainMenu) }; VViewSimpleMenu hideMenu = new VViewSimpleMenu(HIDItems, "Hidden"); /*dispModeMenu.setRoot((IVViewMenu)mainMenu); */ mainMenu.setRoot((IVViewMenu)hideMenu); activeMenu = hideMenu; }
public void setRoot(IVViewMenu root) { this.rootMenu = root; }