// Displays the footer with the current cost and maybe an "execute"-button; returns true, if that button was pressed: protected static bool DisplayFooter(double cost, bool displayButton) { var currentFunds = KSTS.GetFunds(); var fundsColor = "#B3D355"; // Green if (cost > currentFunds) { fundsColor = "#D35555"; // Red } GUILayout.BeginHorizontal(); GUILayout.Label("<size=14><b>Total Mission-Cost: <color=" + fundsColor + ">" + cost.ToString("#,##0 √") + "</color></b></size>", new GUIStyle(GUI.labelStyle) { stretchWidth = true }); if (cost <= currentFunds && displayButton) { if (GUILayout.Button("Start Mission", new GUIStyle(GUI.buttonStyle) { stretchWidth = false })) { return(true); } } GUILayout.EndHorizontal(); return(false); }
public static bool Display() { currentCost = 0; var ready = DisplayInner(); var launch = DisplayFooter(currentCost, ready); if (launch) { // Start the mission: MissionController.StartMission(Mission.CreateConstruction(shipName, payloadShipSelector.payload.template, targetVesselSelector.targetVessel, missionProfileSelector.selectedProfile, crewTransferSelector.crewToDeliver, flagSelector.flagURL, constructionTime)); KSTS.AddFunds(-currentCost); Reset(); return(true); } return(false); }
public static bool Display() { currentCost = 0; var ready = DisplayInner(); var launch = DisplayFooter(currentCost, ready); if (launch) { // Start the mission: MissionController.StartMission(Mission.CreateDeployment(shipName, payloadShipSelector.payload.template, orbitEditor.GetOrbit(), missionProfileSelector.selectedProfile, crewTransferSelector.crewToDeliver, flagSelector.flagURL)); KSTS.AddFunds(-currentCost); Reset(); return(true); } return(false); }
public static bool Display() { currentCost = 0; var ready = DisplayInner(); var launch = DisplayFooter(currentCost, ready); if (launch) { MissionController.StartMission(Mission.CreateTransport( targetVesselSelector.targetVessel, missionProfileSelector.selectedProfile, payloadResourceSelector.selectedResources, payloadResourceSelector.selectedCrewTransfers )); KSTS.AddFunds(-currentCost); Reset(); return(true); } return(false); }
public static bool Display() { currentCost = 0; bool ready = DisplayInner(); bool launch = DisplayFooter(currentCost, ready); if (launch) { if (!GUIOrbitEditor.CheckOrbitClear(orbitEditor.GetOrbit())) { // The selected orbit is used by another vessel, abort: ScreenMessages.PostScreenMessage("Selected orbit already in use by another vessel, aborting mission!"); } else { // The orbit is clear, start the mission: MissionController.StartMission(Mission.CreateDeployment(shipName, payloadShipSelector.payload.template, orbitEditor.GetOrbit(), missionProfileSelector.selectedProfile, crewTransferSelector.crewToDeliver, flagSelector.flagURL)); KSTS.AddFunds(-currentCost); Reset(); return(true); } } return(false); }