/// <summary>
 /// Draws the state change and radiation (if enabled) information of an element.
 /// </summary>
 /// <param name="drawer">The renderer for the details.</param>
 /// <param name="element">The element to display.</param>
 private void AddPhaseChangeInfo(DetailsPanelDrawer drawer, Element element)
 {
     // Phase change points
     if (element.IsSolid)
     {
         var overheat = lastSelection.overheat;
         lastSelection.boil.AddLine(drawer);
         if (!string.IsNullOrEmpty(overheat.text))
         {
             overheat.AddLine(drawer);
         }
     }
     else if (element.IsLiquid)
     {
         lastSelection.freeze.AddLine(drawer);
         lastSelection.boil.AddLine(drawer);
     }
     else if (element.IsGas)
     {
         lastSelection.freeze.AddLine(drawer);
     }
     // Radiation absorption
     if (DlcManager.FeatureRadiationEnabled())
     {
         string radAbsorb = lastSelection.radiationAbsorption;
         drawer.NewLabel(drawer.Format(STRINGS.UI.DETAILTABS.DETAILS.
                                       RADIATIONABSORPTIONFACTOR.NAME, radAbsorb)).Tooltip(drawer.Format(STRINGS.
                                                                                                         UI.DETAILTABS.DETAILS.RADIATIONABSORPTIONFACTOR.TOOLTIP, radAbsorb));
     }
 }
Пример #2
0
            /// <summary>
            /// Applied before FullDescription runs.
            /// </summary>
            internal static bool Prefix(Element __instance, bool addHardnessColor,
                                        ref string __result)
            {
                var text = OUTER_BUILDER;

                text.Clear();
                text.Append(__instance.Description());
                if (!__instance.IsVacuum)
                {
                    AddPhaseChange(text, __instance, addHardnessColor);
                }
                AddThermal(text, __instance);
                if (DlcManager.FeatureRadiationEnabled())
                {
                    AddRads(text, __instance);
                }
                AddTags(text, __instance);
                __result = text.ToString();
                return(false);
            }
            internal LastSelectionDetails(GameObject go)
            {
                string tempUnits = GameUtil.GetTemperatureUnitSuffix();

                if (go.TryGetComponent(out BuildingComplete bc))
                {
                    building = bc;
                }
                else
                {
                    go.TryGetComponent(out building);
                }
                buildingComplete   = bc;
                creationTimeCached = null;
                go.TryGetComponent(out operational);
                // Use primary element by default, but allow CellSelectionObject to stand in
                if (go.TryGetComponent(out PrimaryElement pe))
                {
                    element = pe.Element;
                    cso     = null;
                }
                else if (go.TryGetComponent(out cso))
                {
                    element = cso.element;
                }
                else
                {
                    element = null;
                }
                primaryElement = pe;
                // Why these in particular? Clay please
                showUptime = go.TryGetComponent(out LogicPorts _) || go.TryGetComponent(
                    out EnergyConsumer _) || go.TryGetComponent(out Battery _);
                target       = go;
                uptimeCached = null;
                if (element != null)
                {
                    string name = element.name;
                    elementName = new InfoLine(ELEMENTAL.PRIMARYELEMENT.NAME.Format(name),
                                               ELEMENTAL.PRIMARYELEMENT.TOOLTIP.Format(name));
                    insulator = GetTCText(element, building, tempUnits,
                                          out thermalConductivity);
                    GetSHCText(element, tempUnits, out specificHeat);
                    if (DlcManager.FeatureRadiationEnabled())
                    {
                        int cell = Grid.PosToCell(go.transform.position);
                        radiationAbsorption = GameUtil.GetFormattedPercent(GameUtil.
                                                                           GetRadiationAbsorptionPercentage(cell) * 100.0f);
                    }
                    else
                    {
                        radiationAbsorption = null;
                    }
                    PopulatePhase(element, out boil, out freeze, out overheat);
                }
                else
                {
                    boil                = default;
                    elementName         = default;
                    freeze              = default;
                    overheat            = default;
                    insulator           = false;
                    radiationAbsorption = null;
                    specificHeat        = default;
                    thermalConductivity = default;
                }
            }