static void Postfix(TooltipController_CrewAC __instance, ProtoCrewMember pcm) { var crewRules = DB.Kerbal(pcm.name).rules; sb.Length = 0; foreach (var rule in Profile.rules) { if (!rule.lifetime) { continue; } if (!crewRules.ContainsKey(rule.name)) { continue; } var level = crewRules[rule.name].problem / rule.fatal_threshold; sb.Append(Lib.BuildString("<b>Career ", rule.name, "</b>: ", Lib.HumanReadablePerc(level), "\n")); } if (sb.Length > 0) { __instance.descriptionString += Lib.BuildString("\n\n", sb.ToString()); } }
// Change the tooltip void ApplyTo(TooltipController_CrewAC tooltip) { if (tooltip == null) { return; } if (!string.IsNullOrEmpty(tooltipName)) { tooltip.titleString = tooltipName.PrintFor(crew); } if (!string.IsNullOrEmpty(informations)) { tooltip.descriptionString = informations.PrintFor(crew); if (crew.type == ProtoCrewMember.KerbalType.Applicant) { tooltip.descriptionString += CheckForErrors(); } UIMasterController.Instance.DespawnTooltip(tooltip); } }