internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { string targetName = context?.targetBody?.displayName ?? "target"; ObserveBodyState losState = (ObserveBodyState)state; if (!losState.requirementMet) { if (losState.occluder != null) { return(Localizer.Format("Occluded by <<1>>", Lib.Color(losState.occluder.displayName, Lib.Kolor.Red))); } if (losState.distance > 0) { return(Localizer.Format("Distance <<1>>", Lib.Color(Lib.HumanReadableDistance(losState.distance), Lib.Kolor.Red))); } if (!losState.angularRequirementMet && (minAngularVelocity != 0 || maxAngularVelocity != 0)) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Red); return(Localizer.Format("Angular velocity <<1>>", angularVelocityStr)); } return(Localizer.Format("<<1>> is <<2>>", targetName, Lib.Color("not visible", Lib.Kolor.Red))); } string result = Localizer.Format("<<1>> is <<2>>", targetName, Lib.Color("visible", Lib.Kolor.Green)); if (losState.angularRequirementMet) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Green); result += ", " + Localizer.Format("angular velocity: <<1>>", angularVelocityStr); } return(result); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { string targetName = context?.targetBody?.displayName.LocalizeRemoveGender() ?? Localizer.Format("#KerCon_ABody"); ObserveBodyState losState = (ObserveBodyState)state; if (!losState.requirementMet) { if (losState.occluder != null) { return(Localizer.Format("#KerCon_OccludedByX", Lib.Color(losState.occluder.displayName.LocalizeRemoveGender(), Lib.Kolor.Red))); // Occluded by <<1>> } if (losState.distance > 0) { return(Localizer.Format("#KerCon_DistanceX", Lib.Color(Lib.HumanReadableDistance(losState.distance), Lib.Kolor.Red))); } if (!losState.angularRequirementMet && (minAngularVelocity != 0 || maxAngularVelocity != 0)) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Red); return(Localizer.Format("#KerCon_AngularVelX", angularVelocityStr)); } return(Localizer.Format("#KerCon_XisY", targetName, Lib.Color(Localizer.Format("#KerCon_NotVisible"), Lib.Kolor.Red))); } string result = Localizer.Format("#KerCon_XisY", targetName, Lib.Color(Localizer.Format("#KerCon_Visible"), Lib.Kolor.Green)); if (losState.angularRequirementMet) { string angularVelocityStr = Lib.Color(losState.angularVelocity.ToString("F1") + " °/m", Lib.Kolor.Green); result += ", " + Localizer.Format("#KerCon_AngularVelX", angularVelocityStr); } return(result); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { SolarElevationState elevationState = (SolarElevationState)state; string degreesString = elevationState.solarElevation.ToString("F1") + " °"; return(Localizer.Format("Solar elevation: <<1>>", Lib.Color(degreesString, elevationState.requirementMet ? Lib.Kolor.Green : Lib.Kolor.Red))); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { EquipmentRunningState equipmentRunningState = (EquipmentRunningState)state; string label = EquipmentData.StatusInfo(equipmentRunningState.equipmentState); if (!string.IsNullOrEmpty(shortDescription)) { label = shortDescription + ": " + label; } return(label); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { ExperimentRunningState runningState = (ExperimentRunningState)state; string label = runningState.experimentState == ExperimentState.running ? Lib.Color(Local.Generic_RUNNING, Lib.Kolor.Green) : Lib.Color(Local.Generic_STOPPED, Lib.Kolor.Red); if (!string.IsNullOrEmpty(shortDescription)) { label = shortDescription + ": " + label; } return(label); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { string label = string.Empty; AboveWaypointState wpState = (AboveWaypointState)state; string elevationString = Lib.BuildString(wpState.elevation.ToString("F1"), " °"); if (wpState.elevation < minElevation) { label = Localizer.Format("#KerCon_elevAboveXisY", // elevation above <<1>>: <<2>> context.waypoint.name, Lib.Color(elevationString, Lib.Kolor.Red)); } else if (wpState.elevation - (90 - minElevation) / 3 < minElevation) { label = Localizer.Format("#KerCon_elevAboveXisY", // elevation above <<1>>: <<2>> context.waypoint.name, Lib.Color(elevationString, Lib.Kolor.Yellow)); } else { label = Localizer.Format("#KerCon_elevAboveXisY", // elevation above <<1>>: <<2>> context.waypoint.name, Lib.Color(elevationString, Lib.Kolor.Green)); } if (minDistance > 0 || maxDistance > 0) { label += "\n\t" + Localizer.Format("#KerCon_DistanceX", Lib.Color(Lib.HumanReadableDistance(wpState.distance), // distance: <<1>> wpState.distanceMet ? Lib.Kolor.Green : Lib.Kolor.Red)); } if (minRadialVelocity > 0) { label += "\n\t" + Localizer.Format("#KerCon_RadialVelX", Lib.Color(Lib.HumanReadableSpeed(wpState.radialVelocity), // radial velocity: <<1>> wpState.radialVelocity >= minRadialVelocity ? Lib.Kolor.Green : Lib.Kolor.Red)); } if (minRadialVelocityChange > 0) { var radialVelocityChangeString = Lib.HumanReadableSpeed(wpState.radialVelocityChange) + "/s"; label += "\n\t" + Localizer.Format("#KerCon_RadialVelChangeX", Lib.Color(radialVelocityChangeString, // radial velocity change: <<1>> wpState.radialVelocityChange >= minRadialVelocityChange ? Lib.Kolor.Green : Lib.Kolor.Red)); } if (minAngularVelocity > 0 || maxAngularVelocity > 0) { label += "\n\t" + Localizer.Format("#KerCon_AngularVelX", Lib.Color(wpState.angularVelocity.ToString("F1") + " °/m", // angular velocity: <<1>> wpState.angularRequirementMet ? Lib.Kolor.Green : Lib.Kolor.Red)); } return(label); }
internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { AltitudeState altitudeState = (AltitudeState)state; if (min != 0 && altitudeState.distance < min) { return(Lib.Color("#KerCon_TooLow", Lib.Kolor.Red)); // too low } if (max != 0 && altitudeState.distance > max) { return(Lib.Color("#KerCon_TooHigh", Lib.Kolor.Red)); } return(Lib.Color("#KerCon_AltOK", Lib.Kolor.Green)); // Alt. OK }
/// <summary> return the text to display in the contract UI as part of the individual vessel state </summary> internal virtual string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state) { return(string.Empty); }