/// <summary> /// Draws the main mission window. /// Do not use currentMission.isDone or missionGoal.isDone(), use status instead!!! /// </summary> /// <param name="id">Identifier.</param> private void drawMainWindow(int id) { Status status = calculateStatus(currentMission, true, activeVessel); GUI.skin = HighLogic.Skin; GUILayout.BeginVertical(); scrollPosition = GUILayout.BeginScrollView(scrollPosition); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Current budget: ", styleValueName); GUILayout.Label(manager.budget + CurrencySuffix, (manager.budget < 0 ? styleValueRed : styleValueGreen)); GUILayout.EndHorizontal(); // Show only when the loaded scene is an editor or a vessel is available and its situation is PRELAUNCH if (HighLogic.LoadedSceneIsEditor || status.onLaunchPad) { VesselResources res = vesselResources; showCostValue("Liquid fuel costs:", res.liquid(), styleValueGreen); showCostValue("Oxidizer costs:", res.oxidizer(), styleValueGreen); showCostValue("Monopropellant costs:", res.mono(), styleValueGreen); showCostValue("Solid fuel costs:", res.solid(), styleValueGreen); showCostValue("Xenon gas costs:", res.xenon(), styleValueGreen); showCostValue("Liquid engines: ", res.engine(), styleValueGreen); showCostValue("Crew insurance: ", res.crew(), styleValueGreen); showCostValue("Other resource costs:", res.materials(), styleValueGreen); showCostValue("Sum:", res.sum(), (res.sum() > manager.budget ? styleValueRed : styleValueGreen)); } if (status.isClientControlled) { MissionStatus s = manager.getClientControlledMission(activeVessel); GUILayout.Label("This vessel is controlled by a client. Do not destroy this vessel! Fine: " + s.punishment + CurrencySuffix, styleWarning); GUILayout.Label("End of life in " + MathTools.formatTime(s.endOfLife - Planetarium.GetUniversalTime())); } else if (status.isOnPassiveMission) { MissionStatus s = manager.getPassiveMission(activeVessel); GUILayout.Label("This vessel is involved in a passive mission. Do not destroy this vessel! Fine: " + s.punishment + CurrencySuffix, styleWarning); GUILayout.Label("End of life in " + MathTools.formatTime(s.endOfLife - Planetarium.GetUniversalTime())); } GUILayout.Space(30); if (currentMission != null) { drawMission(currentMission, status); } else { drawPassiveMissions(manager.getActivePassiveMissions()); if (GUILayout.Button("Configure")) { settingsWindow(!showSettingsWindow); resetCount = 0; } } // if (GUILayout.Button ("Draw landing area!", styleButton)) { // drawLandingArea = !drawLandingArea; // } GUILayout.EndVertical(); GUILayout.EndScrollView(); if (GUILayout.Button("Select mission package")) { createFileBrowser("Select mission from package", selectMissionPackage); } if (currentPackage != null) { if (GUILayout.Button("Open browser window")) { packageWindow(true); } } if (currentMission != null) { if (GUILayout.Button("Deselect mission")) { currentMission = null; } } if (status.missionIsFinishable) { if (GUILayout.Button("Finish the mission!")) { manager.finishMission(currentMission, activeVessel, status.events); hiddenGoals = new List <MissionGoal> (); currentMission = null; } } else { if (status.recyclable) { VesselResources res = vesselResources; showCostValue("Recyclable value: ", res.recyclable(activeVessel.Landed), styleCaption); if (GUILayout.Button("Recycle and end flight!")) { manager.recycleVessel(activeVessel, res.recyclable(activeVessel.Landed)); FlightDriver.TerminateCurrentFlight(); FlightResultsDialog.showExitControls = true; FlightResultsDialog.Display("Vessel has been recycled!"); recycled = true; } } } GUILayout.EndVertical(); GUI.DragWindow(); }