void drawWindow(int windowid) { bool draggable = true; GUILayout.BeginVertical(); if (GUILayout.Button("Compute stages")) { ComputeStages(); } if (KSP.UI.Screens.StageManager.Instance.Stages.Count <= 1) { GUI.enabled = false; } if (GUILayout.Button("Show stages")) { showStages = !showStages; } GUI.enabled = true; plugin.autoUpdateStaging = GUILayout.Toggle(plugin.autoUpdateStaging, "Automatically recompute staging"); bool newAdvancedSimulation = GUILayout.Toggle(advancedSimulation, "Advanced simulation"); if (!newAdvancedSimulation && advancedSimulation) { windowPosition.width = 0; windowPosition.height = 0; } advancedSimulation = newAdvancedSimulation; if (advancedSimulation) { int oldId = planetId; planetId = ComboBox.Box(planetId, planets, planets); GUILayout.BeginHorizontal(); GUILayout.Label("Limit max acceleration to (m/sec): "); maxAcceleration.text = GUILayout.TextField(maxAcceleration.text); GUILayout.EndHorizontal(); if (plot != null) { draggable &= plot.draw(); } if (oldId != planetId) { ComputeStages(); } } plugin.showInFlight = GUILayout.Toggle(plugin.showInFlight, "Show icon in flight"); GUILayout.EndVertical(); if (draggable) { GUI.DragWindow(); } }
void drawWindow(int windowid) { bool draggable = true; GUILayout.BeginVertical(); if (GUILayout.Button("Compute stages")) { ComputeStages(); // reload the ship EditorLogic editor = EditorLogic.fetch; ConfigNode shipCfg = editor.ship.SaveShip(); string filename = "saves/" + HighLogic.SaveFolder + "/Ships/VAB/SmartStage.craft.hidden"; shipCfg.Save(filename); EditorLogic.LoadShipFromFile(filename); EditorLogic.fetch.SetBackup(); } //autoUpdateStaging = GUILayout.Toggle(autoUpdateStaging, "Automatically recompute staging"); bool newAdvancedSimulation = GUILayout.Toggle(advancedSimulation, "Advanced simulation"); if (!newAdvancedSimulation && advancedSimulation) { windowPosition.width = 0; windowPosition.height = 0; } advancedSimulation = newAdvancedSimulation; if (advancedSimulation) { int oldId = planetId; planetId = ComboBox.Box(planetId, planets, planets); GUILayout.BeginHorizontal(); GUILayout.Label("Max acceleration: "); maxAcceleration.text = GUILayout.TextField(maxAcceleration.text); GUILayout.EndHorizontal(); if (plot != null) { draggable &= plot.draw(); } if (oldId != planetId) { ComputeStages(); } } plugin.showInFlight = GUILayout.Toggle(plugin.showInFlight, "Show icon in flight"); GUILayout.EndVertical(); if (draggable) { GUI.DragWindow(); } }