WeightFormatter() public static méthode

public static WeightFormatter ( double weight ) : string
weight double
Résultat string
Exemple #1
0
        private void DrawMass(Stage[] stages)
        {
            GUILayout.BeginVertical(GUILayout.Width(150));
            GUILayout.Label("MASS", headingStyle);

            for (int i = 0; i < stages.Length; i++)
            {
                if (!settings.Get <bool>("_SAVEONCHANGE_SHOW_ALL_STAGES") && stages[i].deltaV == 0)
                {
                    continue;
                }
                GUILayout.Label(EngineerTools.WeightFormatter(stages[i].mass, stages[i].totalMass), dataStyle);
            }

            GUILayout.EndVertical();
        }
Exemple #2
0
        private void DrawVessel()
        {
            if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
            {
                SimManager.Instance.RequestSimulation();
            }

            int stage = stages.Length - 1;

            GUILayout.Label("VESSEL DISPLAY", headingStyle);
            GUILayout.BeginHorizontal(areaStyle);
            GUILayout.BeginVertical();
            settings.Set("*SPACER_VESSEL", "");
            settings.Set("*headingStyle_VESSEL", "VESSEL DISPLAY");

            int stageCount       = stages.Length;
            int stageCountUseful = 0;

            if (settings.Get <bool>("Vessel: Show All DeltaV Stages", true))
            {
                for (int i = stageCount - 1; i >= 0; i--)
                {
                    stageDeltaV = stages[i].deltaV;
                    if (stageDeltaV > 0)
                    {
                        if (settings.Get <bool>("Vessel: DeltaV (Stage)", true))
                        {
                            GUILayout.Label("DeltaV (S" + i + ")", headingStyle);
                        }
                        stageCountUseful++;
                    }
                }

                if (stageCount != numberOfStages || stageCountUseful != numberOfStagesUseful)
                {
                    numberOfStages       = stageCount;
                    numberOfStagesUseful = stageCountUseful;
                    settings.Changed     = true;
                }
            }
            else
            {
                if (settings.Get <bool>("Vessel: DeltaV (Stage)", true))
                {
                    GUILayout.Label("DeltaV (Stage)", headingStyle);
                }
            }
            if (settings.Get <bool>("Vessel: DeltaV (Total)", true))
            {
                GUILayout.Label("DeltaV (Total)", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Specific Impulse", true))
            {
                GUILayout.Label("Specific Impulse", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Mass", true))
            {
                GUILayout.Label("Mass", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust (Maximum)", true))
            {
                GUILayout.Label("Thrust (Maximum)", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust (Throttle)", true))
            {
                GUILayout.Label("Thrust (Throttle)", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Throttle)", true))
            {
                GUILayout.Label("TWR (Throttle)", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Current)", true))
            {
                GUILayout.Label("TWR (Current)", headingStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Surface)", true))
            {
                GUILayout.Label("TWR (Surface)", headingStyle);
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            if (settings.Get <bool>("Vessel: Show All DeltaV Stages"))
            {
                for (int i = stageCount - 1; i >= 0; i--)
                {
                    stageDeltaV = stages[i].deltaV;
                    if (stageDeltaV > 0)
                    {
                        if (settings.Get <bool>("Vessel: DeltaV (Stage)"))
                        {
                            GUILayout.Label(Tools.FormatNumber(stages[i].deltaV, "m/s", 0) + " (" + Tools.FormatTime(stages[i].time) + ")", dataStyle);
                        }
                    }
                }
            }
            else
            {
                if (settings.Get <bool>("Vessel: DeltaV (Stage)"))
                {
                    GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].deltaV, "m/s", 0) + " (" + Tools.FormatTime(stages[Staging.lastStage].time) + ")", dataStyle);
                }
            }
            if (settings.Get <bool>("Vessel: DeltaV (Total)"))
            {
                GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].totalDeltaV, "m/s", 0) + " (" + Tools.FormatTime(stages[Staging.lastStage].totalTime) + ")", dataStyle);
            }
            if (settings.Get <bool>("Vessel: Specific Impulse"))
            {
                GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].isp, "s", 3), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Mass"))
            {
                GUILayout.Label(EngineerTools.WeightFormatter(stages[Staging.lastStage].mass, stages[Staging.lastStage].totalMass), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust (Maximum)"))
            {
                GUILayout.Label(Tools.FormatSI(stages[Staging.lastStage].thrust, Tools.SIUnitType.Force), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust (Throttle)"))
            {
                GUILayout.Label(Tools.FormatSI(stages[Staging.lastStage].actualThrust, Tools.SIUnitType.Force), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Throttle)"))
            {
                GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].actualThrustToWeight, 3), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Current)"))
            {
                GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].thrustToWeight, 3), dataStyle);
            }
            if (settings.Get <bool>("Vessel: Thrust to Weight (Surface)", true))
            {
                GUILayout.Label(Tools.FormatNumber(stages[Staging.lastStage].thrust / (stages[Staging.lastStage].totalMass * (this.vessel.mainBody.gravParameter / Math.Pow(this.vessel.mainBody.Radius, 2))), 3), dataStyle);
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }