Ejemplo n.º 1
0
        public static string RequirementText(string requirement)
        {
            var parts = Lib.Tokenize(requirement, ':');

            var    condition = parts[0];
            string value     = string.Empty;

            if (parts.Count > 1)
            {
                value = parts[1];
            }

            switch (condition)
            {
            case "OrbitMinInclination": return(Lib.BuildString("Min. inclination ", value, "°"));

            case "OrbitMaxInclination": return(Lib.BuildString("Max. inclination ", value, "°"));

            case "OrbitMinEccentricity": return(Lib.BuildString("Min. eccentricity ", value));

            case "OrbitMaxEccentricity": return(Lib.BuildString("Max. eccentricity ", value));

            case "OrbitMinArgOfPeriapsis": return(Lib.BuildString("Min. argument of Pe ", value));

            case "OrbitMaxArgOfPeriapsis": return(Lib.BuildString("Max. argument of Pe ", value));

            case "AltitudeMin": return(Lib.BuildString("Min. altitude ", Lib.HumanReadableRange(Double.Parse(value))));

            case "AltitudeMax":
                var v = Double.Parse(value);
                if (v >= 0)
                {
                    return(Lib.BuildString("Max. altitude ", Lib.HumanReadableRange(v)));
                }
                return(Lib.BuildString("Min. depth ", Lib.HumanReadableRange(-v)));

            case "RadiationMin": return(Lib.BuildString("Min. radiation ", Lib.HumanReadableRadiation(Double.Parse(value))));

            case "RadiationMax": return(Lib.BuildString("Max. radiation ", Lib.HumanReadableRadiation(Double.Parse(value))));

            case "Body": return(PrettyBodyText(value));

            case "TemperatureMin": return(Lib.BuildString("Min. temperature ", Lib.HumanReadableTemp(Double.Parse(value))));

            case "TemperatureMax": return(Lib.BuildString("Max. temperature ", Lib.HumanReadableTemp(Double.Parse(value))));

            case "CrewMin": return(Lib.BuildString("Min. crew ", value));

            case "CrewMax": return(Lib.BuildString("Max. crew ", value));

            case "CrewCapacityMin": return(Lib.BuildString("Min. crew capacity ", value));

            case "CrewCapacityMax": return(Lib.BuildString("Max. crew capacity ", value));

            case "VolumePerCrewMin": return(Lib.BuildString("Min. vol./crew ", Lib.HumanReadableVolume(double.Parse(value))));

            case "VolumePerCrewMax": return(Lib.BuildString("Max. vol./crew ", Lib.HumanReadableVolume(double.Parse(value))));

            case "MaxAsteroidDistance": return(Lib.BuildString("Max. asteroid distance ", Lib.HumanReadableRange(double.Parse(value))));

            case "SunAngleMin": return(Lib.BuildString("Min. sun angle ", Lib.HumanReadableAngle(double.Parse(value))));

            case "SunAngleMax": return(Lib.BuildString("Max. sun angle ", Lib.HumanReadableAngle(double.Parse(value))));

            case "AtmosphereBody": return("Body with atmosphere");

            case "AtmosphereAltMin": return(Lib.BuildString("Min. atmosphere altitude ", value));

            case "AtmosphereAltMax": return(Lib.BuildString("Max. atmosphere altitude ", value));

            case "SurfaceSpeedMin": return(Lib.BuildString("Min. surface speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SurfaceSpeedMax": return(Lib.BuildString("Max. surface speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "VerticalSpeedMin": return(Lib.BuildString("Min. vertical speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "VerticalSpeedMax": return(Lib.BuildString("Max. vertical speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SpeedMin": return(Lib.BuildString("Min. speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SpeedMax": return(Lib.BuildString("Max. speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "DynamicPressureMin": return(Lib.BuildString("Min. dynamic pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "DynamicPressureMax": return(Lib.BuildString("Max. dynamic pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "StaticPressureMin": return(Lib.BuildString("Min. pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "StaticPressureMax": return(Lib.BuildString("Max. pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AtmDensityMin": return(Lib.BuildString("Min. atm. density ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AtmDensityMax": return(Lib.BuildString("Max. atm. density ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AltAboveGroundMin": return(Lib.BuildString("Min. ground altitude ", Lib.HumanReadableRange(double.Parse(value))));

            case "AltAboveGroundMax": return(Lib.BuildString("Max. ground altitude ", Lib.HumanReadableRange(double.Parse(value))));

            case "MissionControlLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.MissionControl), " level ", value));

            case "MissionControlLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.MissionControl), " max. level ", value));

            case "AdministrationLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.Administration), " level ", value));

            case "AdministrationLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.Administration), " max. level ", value));

            case "TrackingStationLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.TrackingStation), " level ", value));

            case "TrackingStationLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.TrackingStation), " max. level ", value));

            case "AstronautComplexLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.AstronautComplex), " level ", value));

            case "AstronautComplexLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.AstronautComplex), " max. level ", value));

            case "Part": return(Lib.BuildString("Needs part ", value));

            case "Module": return(Lib.BuildString("Needs module ", value));

            default:
                return(Lib.SpacesOnCaps(condition));
            }
        }
Ejemplo n.º 2
0
        public static string ReqValueFormat(Require req, object reqValue)
        {
            switch (req)
            {
            case Require.OrbitMinEccentricity:
            case Require.OrbitMaxEccentricity:
            case Require.OrbitMinArgOfPeriapsis:
            case Require.OrbitMaxArgOfPeriapsis:
            case Require.AtmosphereAltMin:
            case Require.AtmosphereAltMax:
                return(((double)reqValue).ToString("F2"));

            case Require.SunAngleMin:
            case Require.SunAngleMax:
            case Require.OrbitMinInclination:
            case Require.OrbitMaxInclination:
                return(Lib.HumanReadableAngle((double)reqValue));

            case Require.TemperatureMin:
            case Require.TemperatureMax:
                return(Lib.HumanReadableTemp((double)reqValue));

            case Require.AltitudeMin:
            case Require.AltitudeMax:
            case Require.AltAboveGroundMin:
            case Require.AltAboveGroundMax:
            case Require.MaxAsteroidDistance:
                return(Lib.HumanReadableDistance((double)reqValue));

            case Require.RadiationMin:
            case Require.RadiationMax:
                return(Lib.HumanReadableRadiation((double)reqValue));

            case Require.VolumePerCrewMin:
            case Require.VolumePerCrewMax:
                return(Lib.HumanReadableVolume((double)reqValue));

            case Require.SurfaceSpeedMin:
            case Require.SurfaceSpeedMax:
            case Require.VerticalSpeedMin:
            case Require.VerticalSpeedMax:
            case Require.SpeedMin:
            case Require.SpeedMax:
                return(Lib.HumanReadableSpeed((double)reqValue));

            case Require.DynamicPressureMin:
            case Require.DynamicPressureMax:
            case Require.StaticPressureMin:
            case Require.StaticPressureMax:
            case Require.AtmDensityMin:
            case Require.AtmDensityMax:
                return(Lib.HumanReadablePressure((double)reqValue));

            case Require.CrewMin:
            case Require.CrewMax:
            case Require.CrewCapacityMin:
            case Require.CrewCapacityMax:
            case Require.AstronautComplexLevelMin:
            case Require.AstronautComplexLevelMax:
            case Require.TrackingStationLevelMin:
            case Require.TrackingStationLevelMax:
            case Require.MissionControlLevelMin:
            case Require.MissionControlLevelMax:
            case Require.AdministrationLevelMin:
            case Require.AdministrationLevelMax:
                return(((int)reqValue).ToString());

            case Require.Module:
                return(KSPUtil.PrintModuleName((string)reqValue));

            case Require.Part:
                return(PartLoader.getPartInfoByName((string)reqValue)?.title ?? (string)reqValue);

            default:
                return(string.Empty);
            }
        }