public static IControl Create(IElement element, IEditorFactory editors) { var orientation = element.GetEnum("Orientation", Orientation.Vertical); var flowDirection = element.GetEnum("FlowDirection", FlowDirection.LeftToRight); return(Layout.StackFromTop( Spacer.Small, Layout.StackFromLeft( editors.RadioButton(orientation) .Option(Orientation.Horizontal, (fg, bg) => StackIcon.Create(Axis2D.Horizontal, fg), "Orientation: Horizontal") .Option(Orientation.Vertical, (fg, bg) => StackIcon.Create(Axis2D.Vertical, fg), "Orientation: Vertical") .Control.WithLabelAbove("Orientation"), Spacer.Medium, editors.Dropdown(flowDirection) .WithLabelAbove("Flow Direction")) .WithInspectorPadding(), Spacer.Medium) .MakeCollapsable(RectangleEdge.Bottom, element.Is("Fuse.Controls.WrapPanel"))); }
public static IControl Create(IElement element, IEditorFactory editors) { var orientation = element.GetEnum("Orientation", Orientation.Vertical); var itemSpacing = element.GetDouble("ItemSpacing", 0.0); return(Layout.StackFromTop( Spacer.Medium, Layout.StackFromLeft( editors.RadioButton(orientation) .Option(Orientation.Horizontal, (fg, bg) => StackIcon.Create(Axis2D.Horizontal, fg), "Orientation: Horizontal") .Option(Orientation.Vertical, (fg, bg) => StackIcon.Create(Axis2D.Vertical, fg), "Orientation: Vertical") .Control.WithLabel("Orientation"), Spacer.Medium, editors.Label("Item Spacing", itemSpacing), editors.Field(itemSpacing) .WithWidth(CellLayout.HalfCellWidth)) .WithInspectorPadding(), Spacer.Medium) .MakeCollapsable(RectangleEdge.Bottom, element.Is("Fuse.Controls.StackPanel"))); }
internal void Update() { // Load Application Launcher if (settingsWindow.launcherButton == null && settings.useStockToolbar) { OnGUIApplicationLauncherReady(); if (settingsWindow.showWindow) { settingsWindow.launcherButton.SetTrue(); } } // Destroy application launcher if (settingsWindow.launcherButton != null && settings.useStockToolbar == false) { removeApplicationLauncher(); } foreach (Part p in FlightGlobals.ActiveVessel.parts) { if (p.Modules.OfType <ModuleParachute>().Any()) { StackIcon chuteIcon = Staging.FindIcon(p); if (chuteIcon != null) { if (origTexture == null) { // First time through, set original texture origTexture = chuteIcon.Bg; } else { // Other times, reset to original first then change below as needed chuteIcon.Bg = origTexture; p.stackIcon.SetBgColor(Color.white); } ModuleParachute chute = p.Modules.GetModules <ModuleParachute>().First(); if (settings.resetOnlyDeployWhenSafe) { chute.deployAltitude = 500f; chute.minAirPressureToOpen = 0.01f; settings.resetOnlyDeployWhenSafe = false; } if (chute.deploymentState == ModuleParachute.deploymentStates.STOWED && FlightGlobals.ActiveVessel.atmDensity > 0) { if (chute.deploySafe == "Safe") { if (settings.clearBackground) { chuteIcon.Bg = settings.safeTexture; } else { p.stackIcon.SetBgColor(settings.safeColor); } } if (chute.deploySafe == "Risky") { if (settings.clearBackground) { chuteIcon.Bg = settings.riskyTexture; } else { p.stackIcon.SetBgColor(settings.riskyColor); } } if (chute.deploySafe == "Unsafe") { if (settings.clearBackground) { chuteIcon.Bg = settings.unSafeTexture; } else { p.stackIcon.SetBgColor(settings.unSafeColor); } } } if (settings.onlyDeployWhenSafe && chute.deploymentState == ModuleParachute.deploymentStates.ACTIVE && FlightGlobals.ActiveVessel.atmDensity > 0) { if (chute.deploySafe == "Safe") { p.stackIcon.SetIconColor(settings.safeColor); chute.deployAltitude = (float)FlightGlobals.ActiveVessel.altitude; chute.minAirPressureToOpen = 0.01f; } else { p.stackIcon.SetIconColor(settings.riskyColor); chute.deployAltitude = 100f; chute.minAirPressureToOpen = 100f; } } } } } }