formatTime() public static method

public static formatTime ( double seconds ) : String
seconds double
return String
コード例 #1
0
        /// <summary>
        /// Draws the currently active passive missions
        /// </summary>
        /// <param name="missions">Missions.</param>
        private void drawPassiveMissions(List <MissionStatus> missions)
        {
            if (missions.Count > 0)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Next payment in", styleValueName);
                GUILayout.Label(MathTools.formatTime(60.0 * 60.0 * 24.0 - (Planetarium.GetUniversalTime() - lastPassiveReward)), styleValueGreen);
                GUILayout.EndHorizontal();

                int total = 0;
                foreach (MissionStatus m in missions)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(m.missionName, styleValueName);
                    GUILayout.Label(m.passiveReward + CurrencySuffix, styleValueGreen);
                    GUILayout.EndHorizontal();
                    total += m.passiveReward;
                }

                GUILayout.Space(20);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Total", styleValueName);
                GUILayout.Label(total + CurrencySuffix, styleValueGreen);
                GUILayout.EndHorizontal();
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws the mission parameters
        /// </summary>
        private void drawMission(Mission mission, Status s)
        {
            if (s.missionAlreadyFinished)
            {
                GUILayout.Label("Mission already finished!", styleWarning);
            }

            GUILayout.Label("Mission: ", styleCaption);
            GUILayout.Label(mission.name, styleText);
            GUILayout.Label("Description: ", styleCaption);
            GUILayout.Label(mission.description, styleText);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Reward: ", styleValueName);
            GUILayout.Label(mission.reward + CurrencySuffix, styleValueGreen);
            GUILayout.EndHorizontal();

            if (mission.passiveMission)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Reward every day: ", styleValueName);
                GUILayout.Label(mission.passiveReward + CurrencySuffix, styleValueGreen);
                GUILayout.EndHorizontal();
            }

            if (mission.lifetime != 0.0)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Lifetime: ", styleValueName);
                GUILayout.Label(MathTools.formatTime(mission.lifetime), styleValueGreen);
                GUILayout.EndHorizontal();
            }

            if (mission.clientControlled)
            {
                GUILayout.Label("The client will get the control over this vessel once the mission is finished!", styleWarning);
            }

            if (mission.repeatable)
            {
                GUILayout.Label("Mission is repeatable!", styleCaption);
            }

            if (s.requiresAnotherMission)
            {
                GUILayout.Label("This mission requires the mission \"" + mission.requiresMission + "\". Finish mission \"" +
                                mission.requiresMission + "\" first, before you proceed.", styleWarning);
            }

            drawMissionGoals(mission, s);

            if (s.missionIsFinishable)
            {
                GUILayout.Label("All goals accomplished. You can finish the mission now!", styleCaption);
            }
        }
コード例 #3
0
        protected override List <Value> values(Vessel vessel, GameEvent events)
        {
            List <Value> values = new List <Value> ();

            if (eccentricity != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Eccentricity", String.Format(MathTools.Range, eccentricity, eccentricityPrecision)));
                }
                else
                {
                    values.Add(new Value("Eccentricity", String.Format(MathTools.Range, eccentricity, eccentricityPrecision),
                                         vessel.orbit.eccentricity, MathTools.inRange(eccentricity, eccentricityPrecision, vessel.orbit.eccentricity)));
                }
            }

            if (body != null)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Body", "" + body));
                }
                else
                {
                    values.Add(new Value("Body", "" + body, vessel.orbit.referenceBody.bodyName, vessel.orbit.referenceBody.bodyName.Equals(body)));
                }
            }

            if (minPeA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min. Periapsis", String.Format(MathTools.SingleDoubleValue, minPeA)));
                }
                else
                {
                    values.Add(new Value("min. Periapsis", String.Format(MathTools.SingleDoubleValue, minPeA),
                                         vessel.orbit.PeA, vessel.orbit.PeA >= minPeA));
                }
            }

            if (minApA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min. Apoapsis", String.Format(MathTools.SingleDoubleValue, minApA)));
                }
                else
                {
                    values.Add(new Value("min. Apoapsis", String.Format(MathTools.SingleDoubleValue, minApA),
                                         vessel.orbit.ApA, vessel.orbit.ApA >= minApA));
                }
            }

            if (maxPeA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max. Periapsis", String.Format(MathTools.SingleDoubleValue, maxPeA)));
                }
                else
                {
                    values.Add(new Value("max. Periapsis", String.Format(MathTools.SingleDoubleValue, maxPeA),
                                         vessel.orbit.PeA, vessel.orbit.PeA <= maxPeA));
                }
            }

            if (maxApA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max. Apoapsis", String.Format(MathTools.SingleDoubleValue, maxApA)));
                }
                else
                {
                    values.Add(new Value("max. Apoapsis", String.Format(MathTools.SingleDoubleValue, maxApA),
                                         vessel.orbit.ApA, vessel.orbit.ApA <= maxApA &&
                                         (vessel.orbit.ApA * maxApA > 0)));    //either both values are positive, or both are negative
                }
            }

            if (minInclination != maxInclination)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Inclination", String.Format(MathTools.MinMaxValue, minInclination, maxInclination)));
                }
                else
                {
                    values.Add(new Value("Inclination", String.Format(MathTools.MinMaxValue, minInclination, maxInclination),
                                         String.Format(MathTools.SingleDoubleValue, vessel.orbit.inclination),
                                         MathTools.inMinMax(minInclination, maxInclination, vessel.orbit.inclination)));
                }
            }

            if (minLan != maxLan)
            {
                if (vessel == null)
                {
                    values.Add(new Value("LAN", String.Format(MathTools.MinMaxValue, minLan, maxLan)));
                }
                else
                {
                    values.Add(new Value("LAN", String.Format(MathTools.MinMaxValue, minLan, maxLan),
                                         vessel.orbit.LAN, MathTools.inMinMax(minLan, maxLan, vessel.orbit.LAN)));
                }
            }

            if (minAltitude != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min Altitude", String.Format(MathTools.SingleDoubleValue, minAltitude)));
                }
                else
                {
                    values.Add(new Value("min Altitude", String.Format(MathTools.SingleDoubleValue, minAltitude),
                                         vessel.orbit.altitude, vessel.orbit.altitude >= minAltitude));
                }
            }

            if (maxAltitude != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max Altitude", String.Format(MathTools.SingleDoubleValue, maxAltitude)));
                }
                else
                {
                    values.Add(new Value("max Altitude", String.Format(MathTools.SingleDoubleValue, maxAltitude),
                                         vessel.orbit.altitude, vessel.orbit.altitude <= maxAltitude));
                }
            }

            if (minSpeedOverGround != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min speed over ground", String.Format(MathTools.SingleDoubleValue, minSpeedOverGround)));
                }
                else
                {
                    values.Add(new Value("min speed over ground", String.Format(MathTools.SingleDoubleValue, minSpeedOverGround),
                                         vessel.horizontalSrfSpeed, vessel.horizontalSrfSpeed >= minSpeedOverGround));
                }
            }

            if (maxSpeedOverGround != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max speed over ground", String.Format(MathTools.SingleDoubleValue, maxSpeedOverGround)));
                }
                else
                {
                    values.Add(new Value("max speed over ground", String.Format(MathTools.SingleDoubleValue, maxSpeedOverGround),
                                         vessel.horizontalSrfSpeed, vessel.horizontalSrfSpeed <= maxSpeedOverGround));
                }
            }

            if (maxEccentricity != minEccentricity)
            {
                // If both min < max, then max has not been set at all and ignore the max value
                if (minEccentricity < maxEccentricity)
                {
                    if (vessel == null)
                    {
                        values.Add(new Value("Eccentricity", String.Format(MathTools.HighPrecisionMinMaxValue, minEccentricity, maxEccentricity)));
                    }
                    else
                    {
                        values.Add(new Value("Eccentricity", String.Format(MathTools.HighPrecisionMinMaxValue, minEccentricity, maxEccentricity),
                                             vessel.orbit.eccentricity, MathTools.inMinMax(minEccentricity, maxEccentricity, vessel.orbit.eccentricity), true));
                    }
                }
                else
                {
                    if (vessel == null)
                    {
                        values.Add(new Value("min. Eccentricity", String.Format(MathTools.HighPrecisionDoubleValue, minEccentricity)));
                    }
                    else
                    {
                        values.Add(new Value("min. Eccentricity", String.Format(MathTools.HighPrecisionDoubleValue, minEccentricity),
                                             vessel.orbit.eccentricity, minEccentricity < vessel.orbit.eccentricity, true));
                    }
                }
            }

            if (minOrbitalPeriod < maxOrbitalPeriod)
            {
                if (vessel == null || Planetarium.fetch == null)
                {
                    values.Add(new Value("Orbital Period", String.Format(MathTools.MinMaxString,
                                                                         MathTools.formatTime(minOrbitalPeriod), MathTools.formatTime(maxOrbitalPeriod))));
                }
                else
                {
                    values.Add(new Value("Orbital Period", String.Format(MathTools.MinMaxString,
                                                                         MathTools.formatTime(minOrbitalPeriod), MathTools.formatTime(maxOrbitalPeriod)),
                                         MathTools.formatTime(vessel.orbit.period), MathTools.inMinMax(minOrbitalPeriod, maxOrbitalPeriod, vessel.orbit.period)));
                }
            }

            if (minVerticalSpeed != 0.0)   //both min and max Vertical Speed variables are tested in game.  Good Test.
            {
                if (vessel == null)
                {
                    values.Add(new Value("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed)));
                }
                else
                {
                    values.Add(new Value("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed),
                                         vessel.verticalSpeed, vessel.verticalSpeed >= minVerticalSpeed));
                }
            }

            if (maxVerticalSpeed != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed)));
                }
                else
                {
                    values.Add(new Value("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed),
                                         vessel.verticalSpeed, vessel.verticalSpeed <= maxVerticalSpeed));
                }
            }

            if (minGForce != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Min G Force", String.Format(MathTools.SingleDoubleValue, minGForce)));
                }
                else
                {
                    values.Add(new Value("Min G Force", String.Format(MathTools.SingleDoubleValue, minGForce),
                                         vessel.geeForce, vessel.geeForce >= minGForce));
                }
            }

            if (maxGForce != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Max G Force", String.Format(MathTools.SingleDoubleValue, maxGForce)));
                }
                else
                {
                    values.Add(new Value("Max G Force", String.Format(MathTools.SingleDoubleValue, maxGForce),
                                         vessel.geeForce, vessel.geeForce <= maxGForce));
                }
            }

            if (minLatitude != maxLatitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude)));
                }
                else
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude),
                                         vessel.latitude, MathTools.inMinMax(minLatitude, maxLatitude, vessel.latitude)));
                }
            }

            if (minLongitude != maxLongitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude)));
                }
                else
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude),
                                         MathTools.calculateLongitude(vessel.longitude),
                                         MathTools.inMinMax(minLongitude, maxLongitude, MathTools.calculateLongitude(vessel.longitude))));
                }
            }

            return(values);
        }
コード例 #4
0
        /// <summary>
        /// Returns all values related to this mission goal
        /// </summary>
        /// <returns>The values.</returns>
        /// <param name="vessel">current vessel</param>
        public List <Value> getValues(Vessel vessel, GameEvent events)
        {
            List <Value> vs = values(vessel, events);

            if (crewCount != 0)
            {
                if (vessel == null)
                {
                    vs.Add(new Value("Crew count", "" + crewCount));
                }
                else
                {
                    vs.Add(new Value("Crew count", "" + crewCount, "" + vessel.GetCrewCount(),
                                     crewCount <= vessel.GetCrewCount()));
                }
            }

            if (minTotalMass != 0.0)
            {
                if (vessel == null)
                {
                    vs.Add(new Value("min. total mass", String.Format(MathTools.SingleDoubleValue, minTotalMass)));
                }
                else
                {
                    vs.Add(new Value("min. total mass", String.Format(MathTools.SingleDoubleValue, minTotalMass),
                                     String.Format(MathTools.SingleDoubleValue, vessel.GetTotalMass()),
                                     vessel.GetTotalMass() >= minTotalMass));
                }
            }

            if (maxTotalMass != 0.0)
            {
                if (vessel == null)
                {
                    vs.Add(new Value("max. total mass", String.Format(MathTools.SingleDoubleValue, maxTotalMass)));
                }
                else
                {
                    vs.Add(new Value("max. total mass", String.Format(MathTools.SingleDoubleValue, maxTotalMass),
                                     String.Format(MathTools.SingleDoubleValue, vessel.GetTotalMass()),
                                     vessel.GetTotalMass() <= maxTotalMass));
                }
            }

            bool done = true;

            foreach (Value v in vs)
            {
                done = done && v.done;
            }

            // If the mission goal is finished so far and we need to throttle down in order
            // to finish the mission goal, add another value if not throttled down
            if (vessel != null)
            {
                if (done && throttleDown && FlightInputHandler.state.mainThrottle != 0.0)
                {
                    vs.Add(new Value("Throttle down!", "true", "false", false));
                    done = false;
                }
            }

            if (done && timeStarted == -1.0 && minSeconds > 0.0)
            {
                timeStarted = Planetarium.GetUniversalTime();
            }

            if (minSeconds > 0.0 && !done)
            {
                timeStarted = -1.0;
            }

            if (minSeconds > 0.0)
            {
                if (vessel != null)
                {
                    double diff = (timeStarted == -1.0 ? 0 : Planetarium.GetUniversalTime() - timeStarted);
                    vs.Add(new Value("Minimal time", MathTools.formatTime(minSeconds), MathTools.formatTime(diff), diff > minSeconds));
                }
                else
                {
                    vs.Add(new Value("Minimal time", MathTools.formatTime(minSeconds)));
                }
            }

            return(vs);
        }
コード例 #5
0
        /// <summary>
        /// Draws the mission parameters
        /// </summary>
        private void drawMission(Mission mission, Status s)
        {
            if (s.missionAlreadyFinished)
            {
                GUILayout.Label("Mission already finished!", styleWarning);
            }

            GUILayout.Label("Mission: ", styleValueGreenBold);
            GUILayout.Label(mission.name, styleText);
            GUILayout.Label("Description: ", styleCaption);
            GUILayout.Label(mission.description, styleText);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Reward: ", styleValueGreenBold);
            if (settings.difficulty == 1)
            {
                GUILayout.Label(mission.reward + CurrencySuffix, styleValueYellow);
            }
            if (settings.difficulty == 2)
            {
                GUILayout.Label(mission.reward * 60 / 100 + CurrencySuffix, styleValueYellow);
            }
            GUILayout.EndHorizontal();

            if (mission.passiveMission)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Reward every day: ", styleValueYellow);
                GUILayout.Label(mission.passiveReward + CurrencySuffix, styleValueGreen);
                GUILayout.EndHorizontal();
            }

            if (mission.lifetime != 0.0)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Lifetime: ", styleValueYellow);
                GUILayout.Label(MathTools.formatTime(mission.lifetime), styleValueGreen);
                GUILayout.EndHorizontal();
            }

            if (mission.clientControlled)
            {
                GUILayout.Label("The client will get the control over this vessel once the mission is finished!", styleWarning);
            }

            if (mission.repeatable)
            {
                GUILayout.Label("Mission is repeatable!", styleCaption);
            }

            if (s.requiresAnotherMission)
            {
                GUILayout.Label("This mission requires the mission \"" + mission.requiresMission + "\". Finish mission \"" +
                                mission.requiresMission + "\" first, before you proceed.", styleWarning);
            }

            drawMissionGoals(mission, s);

            if (s.missionIsFinishable)
            {
                if (manager.budget < 0)
                {
                    if (settings.difficulty == 1)
                    {
                        GUILayout.Label("All goals accomplished. You can finish the mission now! Deducted 25% for loans!", styleCaption);
                        showCostValue("Total Mission Payout:", currentMission.reward * 75 / 100, styleValueGreen);
                    }
                    if (settings.difficulty == 2)
                    {
                        GUILayout.Label("All Goals accomplished. Finish The Mission. Deducted 25% for loans and 40% for HardCore mode"); // .75 * .6 = .45
                        showCostValue("Total Mission Payout:", currentMission.reward * 45 / 100, styleValueGreen);
                    }
                }
                else
                {
                    if (settings.difficulty == 1)
                    {
                        GUILayout.Label("All goals accomplished. you can finish the mission now!", styleCaption);
                        showCostValue("Total Mission Payout:", currentMission.reward, styleValueGreen);
                    }
                    if (settings.difficulty == 2)
                    {
                        GUILayout.Label("All goals accomplished. you can finish the mission now: HardCore Mode 40 % Reduction!", styleCaption);
                        showCostValue("Total Mission Payout:", currentMission.reward * 60 / 100, styleValueGreen);
                    }
                }
            }
        }
コード例 #6
0
        /// <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();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Current budget: ", styleValueYellow);
            GUILayout.Label(manager.budget + CurrencySuffix, (manager.budget < 0 ? styleValueRedBold : styleValueGreenBold));
            GUILayout.EndHorizontal();
            // Edits malkuth shows the modes that you have the plugin set to from settings .13 added the Borrowing Money mission deduction of %25
            if (settings.disablePlugin == true)
            {
                GUILayout.Label("PLUGIN IS DISABLED ", styleValueYellow);
            }
            if (settings.difficulty == 0)
            {
                GUILayout.Label("Test Flight Mode ", styleValueYellow);
            }
            if (settings.difficulty == 1)
            {
                GUILayout.Label("Flight Mode ", styleValueGreen);
            }
            if (manager.budget < 0)
            {
                GUILayout.Label("In Red, Borrowing Money", styleWarning);
            }
            if (settings.difficulty == 2)
            {
                GUILayout.Label("HardCore Mode", styleValueRed);
            }
            // Show only when the loaded scene is an editor or a vessel is available and its situation is PRELAUNCH

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            if (HighLogic.LoadedSceneIsEditor || status.onLaunchPad)
            {
                VesselResources res = new VesselResources(activeVessel);

                // .11 Edited malkuth shows only when in Testing Mode.  Plan to add things like Delta V stats and other Helpful testing info
                if (settings.difficulty == 0)
                {
                    GUILayout.Label("Flight Test Mode, No Missions, Cost Reduced to 6%", styleCaption);
                    showCostValue("Flight Testing Cost:", res.dry() * 6 / 100, (res.dry() * 6 / 100 > manager.budget ? styleValueRedBold : styleValueYellow));
                }
                else
                {
                    // .11 Edited malkuth shows only when in flight mode. New Edit for .12 values only show if Price is above 0.. Little GUI cleanup that I think works better. .12 Edit Added Oxegen and Modular Fuel Cost
                    GUILayout.Label("Flight Mode Selected, Vessel launch Full Price. Missions Available ", styleCaption);
                    if (res.pod() > (0))
                    {
                        showCostValue("Command Sections:", res.pod(), styleValueGreen);
                    }
                    showCostValue("Crew insurance (Launch Pad Only): ", res.crew(), styleValueGreen);
                    if (res.ctrl() > (0))
                    {
                        showCostValue("Avionics and Control:", res.ctrl(), styleValueGreen);
                    }                                                                                                  // NOT control surfaces. Those are AERO parts. These are SAS etc
                    if (res.util() > (0))
                    {
                        showCostValue("Utility Parts:", res.util(), styleValueGreen);
                    }
                    if (res.sci() > (0))
                    {
                        showCostValue("Science Parts:", res.sci(), styleValueGreen);
                    }
                    if (res.engine() > (0))
                    {
                        showCostValue("Engines And Cooling: ", res.engine(), styleValueGreen);
                    }
                    if (res.tank() > (0))
                    {
                        showCostValue("Fuel Tank Cost: ", res.tank(), styleValueGreen);
                    }
                    if (res.oxylife() > (0))
                    {
                        showCostValue("Oxygen Life Support: ", res.oxylife(), styleValueGreen);
                    }
                    if (res.LiquidOxy() > (0))
                    {
                        showCostValue("LiquidOxygen fuel costs:", res.LiquidOxy(), styleValueGreen);
                    }
                    if (res.LiquidH() > (0))
                    {
                        showCostValue("LiquidH2O:", res.LiquidH(), styleValueGreen);
                    }
                    if (res.liquid() > (0))
                    {
                        showCostValue("Liquid fuel costs:", res.liquid(), styleValueGreen);
                    }
                    if (res.oxidizer() > (0))
                    {
                        showCostValue("Oxidizer costs:", res.oxidizer(), styleValueGreen);
                    }
                    if (res.mono() > (0))
                    {
                        showCostValue("Monopropellant costs:", res.mono(), styleValueGreen);
                    }
                    if (res.solid() > (0))
                    {
                        showCostValue("Solid fuel costs:", res.solid(), styleValueGreen);
                    }
                    if (res.xenon() > (0))
                    {
                        showCostValue("Xenon gas costs:", res.xenon(), styleValueGreen);
                    }
                    if (res.stru() > (0))
                    {
                        showCostValue("Structural Cost:", res.stru(), styleValueGreen);
                    }
                    if (res.aero() > (0))
                    {
                        showCostValue("Aerodynamic Cost:", res.aero(), styleValueGreen);
                    }
                    if (res.wet() > (0))
                    {
                        showCostValue("(Total Cost Of Fuels):", res.wet(), styleCaption);
                    }
                    if (res.dry() > (0))
                    {
                        showCostValue("(Total Cost Of Parts):", res.dry(), styleCaption);
                    }
                    showCostValue("Total Cost Of Vessel With All:", res.sum(), (res.sum() > manager.budget ? styleValueRedBold : styleValueYellow));
                }
            }


            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()));
            }

            ;

            if (currentMission != null)
            {
                drawMission(currentMission, status);
            }



            GUILayout.Space(30);
            GUILayout.EndScrollView();

            if (GUILayout.Button("Configure"))
            {
                settingsWindow(!showSettingsWindow);
                resetCount = 0;
            }

            if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight && GUILayout.Button("Financing"))
            {
                financeWindow(!showFinanceWindow);
                resetCount = 0;
            }

            if (!HighLogic.LoadedSceneIsFlight && GUILayout.Button("KerbalNauts"))
            {
                kerbalNautsWindow(!showkerbalwindow);
                resetCount = 0;
            }


//            if (GUILayout.Button ("Draw landing area!", styleButton)) {
//                drawLandingArea = !drawLandingArea;
//            }

            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;
                }
            }
            // NK recycle from tracking station
            if (HighLogic.LoadedScene.Equals(GameScenes.TRACKSTATION) && pVessel != null && settings.difficulty != 0)
            {
                //print("*MC* In TS, pVessel not null");
                if (pVessel.situation.Equals(Vessel.Situations.LANDED) || pVessel.situation.Equals(Vessel.Situations.SPLASHED))
                {
                    VesselResources res = new VesselResources(pVessel.vesselRef);
                    showCostValue("Recyclable value: ", res.recyclable(pVessel.situation.Equals(Vessel.Situations.LANDED)), styleCaption);
                }
            }

            GUILayout.EndVertical();
            GUI.DragWindow();
        }
コード例 #7
0
        /// <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();
        }