private void Awake()
    {
        GameObject          gameObject  = Util.KInstantiate(CellSelectionPrefab, null, "WorldSelectionCollider");
        GameObject          gameObject2 = Util.KInstantiate(CellSelectionPrefab, null, "WorldSelectionCollider");
        CellSelectionObject component   = gameObject.GetComponent <CellSelectionObject>();

        (component.alternateSelectionObject = gameObject2.GetComponent <CellSelectionObject>()).alternateSelectionObject = component;
    }
 private void MiscCardExposedToSpace(HoverTextDrawer hoverTextDrawer)
 {
     if (CellSelectionObject.IsExposedToSpace(cellPos))
     {
         hoverTextDrawer.NewLine(26);
         hoverTextDrawer.DrawIcon(__this.iconDash, 18);
         hoverTextDrawer.DrawText(MISC.STATUSITEMS.SPACE.NAME, __this.Styles_BodyText.Standard);
     }
 }
 private bool CreateDiseaseInfo_CellSelectionObject(CellSelectionObject cso)
 {
     if (cso.diseaseIdx != 255 && cso.diseaseCount > 0)
     {
         Disease disease = Db.Get().Diseases[cso.diseaseIdx];
         int     idx     = cso.element.idx;
         BuildFactorsStrings(cso.diseaseCount, idx, -1, cso.Mass, cso.temperature, null, disease);
         return(true);
     }
     return(false);
 }
    public void UpdatePortrait(GameObject target)
    {
        KSelectable component = target.GetComponent <KSelectable>();

        if (!((UnityEngine.Object)component == (UnityEngine.Object)null))
        {
            TabTitle.portrait.ClearPortrait();
            Building component2 = component.GetComponent <Building>();
            if ((bool)component2)
            {
                Sprite sprite = null;
                sprite = component2.Def.GetUISprite("ui", false);
                if ((UnityEngine.Object)sprite != (UnityEngine.Object)null)
                {
                    TabTitle.portrait.SetPortrait(sprite);
                    return;
                }
            }
            MinionIdentity component3 = target.GetComponent <MinionIdentity>();
            if ((bool)component3)
            {
                TabTitle.SetPortrait(component.gameObject);
            }
            else
            {
                Edible component4 = target.GetComponent <Edible>();
                if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
                {
                    KBatchedAnimController component5  = component4.GetComponent <KBatchedAnimController>();
                    Sprite uISpriteFromMultiObjectAnim = Def.GetUISpriteFromMultiObjectAnim(component5.AnimFiles[0], "ui", false, string.Empty);
                    TabTitle.portrait.SetPortrait(uISpriteFromMultiObjectAnim);
                }
                else
                {
                    PrimaryElement component6 = target.GetComponent <PrimaryElement>();
                    if ((UnityEngine.Object)component6 != (UnityEngine.Object)null)
                    {
                        TabTitle.portrait.SetPortrait(Def.GetUISpriteFromMultiObjectAnim(ElementLoader.FindElementByHash(component6.ElementID).substance.anim, "ui", false, string.Empty));
                    }
                    else
                    {
                        CellSelectionObject component7 = target.GetComponent <CellSelectionObject>();
                        if ((UnityEngine.Object)component7 != (UnityEngine.Object)null)
                        {
                            string animName = (!component7.element.IsSolid) ? component7.element.substance.name : "ui";
                            Sprite uISpriteFromMultiObjectAnim2 = Def.GetUISpriteFromMultiObjectAnim(component7.element.substance.anim, animName, false, string.Empty);
                            TabTitle.portrait.SetPortrait(uISpriteFromMultiObjectAnim2);
                        }
                    }
                }
            }
        }
    }
        private static void Postfix(CellSelectionObject __instance)
        {
            SimMessages_Utils.Log(MethodBase.GetCurrentMethod(),
                                  __instance);

            FieldInfo fi = AccessTools.Field(typeof(CellSelectionObject), "selectedCell");

            if (Grid.IsValidCell((int)fi.GetValue(__instance)))
            {
                //__instance.Mass = Grid.Mass[(int)fi.GetValue(__instance)];
                __instance.ElementName = __instance.ElementName + " " + (int)fi.GetValue(__instance);
            }
        }
    private string GetSelectedObjectCodexID()
    {
        string text = string.Empty;
        CellSelectionObject       component  = SelectTool.Instance.selected.GetComponent <CellSelectionObject>();
        BuildingUnderConstruction component2 = SelectTool.Instance.selected.GetComponent <BuildingUnderConstruction>();
        CreatureBrain             component3 = SelectTool.Instance.selected.GetComponent <CreatureBrain>();
        PlantableSeed             component4 = SelectTool.Instance.selected.GetComponent <PlantableSeed>();
        BudUprootedMonitor        component5 = SelectTool.Instance.selected.GetComponent <BudUprootedMonitor>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            text = CodexCache.FormatLinkID(component.element.id.ToString());
        }
        else if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            text = CodexCache.FormatLinkID(component2.Def.PrefabID);
        }
        else if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
        {
            text = CodexCache.FormatLinkID(SelectTool.Instance.selected.PrefabID().ToString());
            text = text.Replace("BABY", string.Empty);
        }
        else if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
        {
            text = CodexCache.FormatLinkID(SelectTool.Instance.selected.PrefabID().ToString());
            text = text.Replace("SEED", string.Empty);
        }
        else if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
        {
            if ((UnityEngine.Object)component5.parentObject.Get() != (UnityEngine.Object)null)
            {
                text = CodexCache.FormatLinkID(component5.parentObject.Get().PrefabID().ToString());
            }
            else if ((UnityEngine.Object)component5.GetComponent <TreeBud>() != (UnityEngine.Object)null)
            {
                text = CodexCache.FormatLinkID(component5.GetComponent <TreeBud>().buddingTrunk.Get().PrefabID().ToString());
            }
        }
        else
        {
            text = CodexCache.FormatLinkID(SelectTool.Instance.selected.PrefabID().ToString());
        }
        if (CodexCache.entries.ContainsKey(text) || CodexCache.FindSubEntry(text) != null)
        {
            return(text);
        }
        return(string.Empty);
    }
    private bool CreateDiseaseInfo()
    {
        PrimaryElement component = selectedTarget.GetComponent <PrimaryElement>();

        if ((Object)component != (Object)null)
        {
            return(CreateDiseaseInfo_PrimaryElement());
        }
        CellSelectionObject component2 = selectedTarget.GetComponent <CellSelectionObject>();

        if ((Object)component2 != (Object)null)
        {
            return(CreateDiseaseInfo_CellSelectionObject(component2));
        }
        return(false);
    }
        private void ItemCardThermal(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3)
        {
            if (kselectable3.GetComponent <Constructable>())
            {
                return;
            }
            if (CurrentMode != OverlayModes.None.ID && CurrentMode != OverlayModes.Temperature.ID)
            {
                return;
            }
            // None か Temperatureオーバーレイでのみ表示

            PrimaryElement primaryElement = kselectable3.GetComponent <PrimaryElement>();
            float          temp           = 0f;
            float          dtu            = -1f;
            bool           flag10         = CurrentMode == OverlayModes.Temperature.ID && Game.Instance.temperatureOverlayMode != Game.TemperatureOverlayModes.HeatFlow;

            if (flag10 && primaryElement)
            {
                temp = primaryElement.Temperature;
                dtu  = temp * primaryElement.Element.specificHeatCapacity * primaryElement.Mass;
            }
            else if (kselectable3.GetComponent <Building>() && primaryElement)
            {
                temp = primaryElement.Temperature;
                dtu  = temp * primaryElement.Element.specificHeatCapacity * primaryElement.Mass;
            }
            else if (kselectable3.GetComponent <CellSelectionObject>() != null)
            {
                CellSelectionObject obj = kselectable3.GetComponent <CellSelectionObject>();
                temp = obj.temperature;
                dtu  = temp * obj.element.specificHeatCapacity * obj.Mass;
            }
            else
            {
                return;
            }

            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawIcon(__this.iconDash, 18);
            hoverTextDrawer.DrawText(GameUtil.GetFormattedTemperature(temp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), __this.Styles_BodyText.Standard);

            DrawKiloDTU(hoverTextDrawer, dtu);
        }
        private void MiscCard(HoverTextDrawer hoverTextDrawer)
        {
            CellSelectionObject cellSelectionObject = this.cellSelectionObject;
            bool flag12 = cellSelectionObject != null && cellSelectionObject.mouseCell == cellSelectionObject.alternateSelectionObject.mouseCell;

            if (flag12)
            {
                __this.currentSelectedSelectableIndex = __this.recentNumberOfDisplayedSelectables - 1;
            }
            hoverTextDrawer.BeginShadowBar(flag12);

            MiscCardElement(hoverTextDrawer);
            MiscCardDisease(hoverTextDrawer);
            MiscCardElementCategory(hoverTextDrawer);
            MiscCardMass(hoverTextDrawer);
            MiscCardTemperature(hoverTextDrawer);
            MiscCardExposedToSpace(hoverTextDrawer);
            MiscCardEntombedItem(hoverTextDrawer);
            MiscCardOxyRock(hoverTextDrawer);

            hoverTextDrawer.EndShadowBar();
        }
 public void Refresh(GameObject go)
 {
     if (screens != null)
     {
         target = go;
         CellSelectionObject component = target.GetComponent <CellSelectionObject>();
         if ((bool)component)
         {
             component.OnObjectSelected(null);
         }
         if (!HasActivated)
         {
             if (screens != null)
             {
                 for (int i = 0; i < screens.Length; i++)
                 {
                     GameObject gameObject = null;
                     gameObject        = KScreenManager.Instance.InstantiateScreen(screens[i].screen.gameObject, body.gameObject).gameObject;
                     screens[i].screen = gameObject.GetComponent <TargetScreen>();
                     screens[i].tabIdx = AddTab(screens[i].icon, Strings.Get(screens[i].displayName), screens[i].screen, Strings.Get(screens[i].tooltip));
                 }
             }
             base.onTabActivated += OnTabActivated;
             HasActivated         = true;
         }
         int num  = -1;
         int num2 = 0;
         for (int j = 0; j < screens.Length; j++)
         {
             bool flag  = screens[j].screen.IsValidForTarget(go);
             bool flag2 = screens[j].hideWhenDead && base.gameObject.HasTag(GameTags.Dead);
             bool flag3 = flag && !flag2;
             SetTabEnabled(screens[j].tabIdx, flag3);
             if (flag3)
             {
                 num2++;
                 if (num == -1)
                 {
                     if (SimDebugView.Instance.GetMode() != OverlayModes.None.ID)
                     {
                         if (SimDebugView.Instance.GetMode() == screens[j].focusInViewMode)
                         {
                             num = j;
                         }
                     }
                     else if (flag3 && previouslyActiveTab >= 0 && previouslyActiveTab < screens.Length && screens[j].name == screens[previouslyActiveTab].name)
                     {
                         num = screens[j].tabIdx;
                     }
                 }
             }
         }
         if (num != -1)
         {
             ActivateTab(num);
         }
         else
         {
             ActivateTab(0);
         }
         tabHeaderContainer.gameObject.SetActive((CountTabs() > 1) ? true : false);
         if (sideScreens != null && sideScreens.Count > 0)
         {
             sideScreens.ForEach(delegate(SideScreenRef scn)
             {
                 if (scn.screenPrefab.IsValidForTarget(target))
                 {
                     if ((UnityEngine.Object)scn.screenInstance == (UnityEngine.Object)null)
                     {
                         scn.screenInstance = Util.KInstantiateUI <SideScreenContent>(scn.screenPrefab.gameObject, sideScreenContentBody, false);
                     }
                     if (!sideScreen.activeInHierarchy)
                     {
                         sideScreen.SetActive(true);
                     }
                     scn.screenInstance.transform.SetAsFirstSibling();
                     scn.screenInstance.SetTarget(target);
                     scn.screenInstance.Show(true);
                     currentSideScreen = scn.screenInstance;
                     RefreshTitle();
                 }
             });
         }
     }
 }
Example #11
0
    private void SetPanels(GameObject target)
    {
        MinionIdentity            component  = target.GetComponent <MinionIdentity>();
        Amounts                   amounts    = target.GetAmounts();
        PrimaryElement            component2 = target.GetComponent <PrimaryElement>();
        BuildingComplete          component3 = target.GetComponent <BuildingComplete>();
        BuildingUnderConstruction component4 = target.GetComponent <BuildingUnderConstruction>();
        CellSelectionObject       component5 = target.GetComponent <CellSelectionObject>();
        InfoDescription           component6 = target.GetComponent <InfoDescription>();
        Edible component7 = target.GetComponent <Edible>();

        attributeLabels.ForEach(delegate(LocText x)
        {
            UnityEngine.Object.Destroy(x.gameObject);
        });
        attributeLabels.Clear();
        vitalsPanel.gameObject.SetActive(amounts != null);
        string text  = string.Empty;
        string text2 = string.Empty;

        if (amounts != null)
        {
            vitalsContainer.selectedEntity = selectedTarget;
            Uprootable component8 = selectedTarget.gameObject.GetComponent <Uprootable>();
            if ((UnityEngine.Object)component8 != (UnityEngine.Object)null)
            {
                vitalsPanel.gameObject.SetActive((UnityEngine.Object)component8.GetPlanterStorage != (UnityEngine.Object)null);
            }
            WiltCondition component9 = selectedTarget.gameObject.GetComponent <WiltCondition>();
            if ((UnityEngine.Object)component9 != (UnityEngine.Object)null)
            {
                vitalsPanel.gameObject.SetActive(true);
            }
        }
        if ((bool)component)
        {
            text = string.Empty;
        }
        else if ((bool)component6)
        {
            text = component6.description;
        }
        else if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
        {
            text  = component3.Def.Effect;
            text2 = component3.Def.Desc;
        }
        else if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
        {
            text  = component4.Def.Effect;
            text2 = component4.Def.Desc;
        }
        else if ((UnityEngine.Object)component7 != (UnityEngine.Object)null)
        {
            EdiblesManager.FoodInfo foodInfo = component7.FoodInfo;
            text += string.Format(UI.GAMEOBJECTEFFECTS.CALORIES, GameUtil.GetFormattedCalories(foodInfo.CaloriesPerUnit, GameUtil.TimeSlice.None, true));
        }
        else if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
        {
            text = component5.element.FullDescription(false);
        }
        else if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            Element element = ElementLoader.FindElementByHash(component2.ElementID);
            text = ((element == null) ? string.Empty : element.FullDescription(false));
        }
        List <Descriptor> gameObjectEffects = GameUtil.GetGameObjectEffects(target, true);
        bool flag = gameObjectEffects.Count > 0;

        descriptionContainer.gameObject.SetActive(flag);
        descriptionContainer.descriptors.gameObject.SetActive(flag);
        if (flag)
        {
            descriptionContainer.descriptors.SetDescriptors(gameObjectEffects);
        }
        descriptionContainer.description.text = text;
        descriptionContainer.flavour.text     = text2;
        infoPanel.gameObject.SetActive((UnityEngine.Object)component == (UnityEngine.Object)null);
        descriptionContainer.gameObject.SetActive(infoPanel.activeSelf);
        descriptionContainer.flavour.gameObject.SetActive(text2 != string.Empty && text2 != "\n");
        if (vitalsPanel.gameObject.activeSelf && amounts.Count == 0)
        {
            vitalsPanel.gameObject.SetActive(false);
        }
    }
    private void RefreshDetails()
    {
        detailsPanel.SetActive(true);
        detailsPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.DETAILS.GROUPNAME_DETAILS;
        PrimaryElement      component  = selectedTarget.GetComponent <PrimaryElement>();
        CellSelectionObject component2 = selectedTarget.GetComponent <CellSelectionObject>();
        float   mass;
        float   temperature;
        Element element;
        byte    diseaseIdx;
        int     diseaseCount;

        if ((Object)component != (Object)null)
        {
            mass         = component.Mass;
            temperature  = component.Temperature;
            element      = component.Element;
            diseaseIdx   = component.DiseaseIdx;
            diseaseCount = component.DiseaseCount;
        }
        else
        {
            if (!((Object)component2 != (Object)null))
            {
                return;
            }
            mass         = component2.Mass;
            temperature  = component2.temperature;
            element      = component2.element;
            diseaseIdx   = component2.diseaseIdx;
            diseaseCount = component2.diseaseCount;
        }
        bool             flag = element.id == SimHashes.Vacuum || element.id == SimHashes.Void;
        float            specificHeatCapacity = element.specificHeatCapacity;
        float            highTemp             = element.highTemp;
        float            lowTemp    = element.lowTemp;
        BuildingComplete component3 = selectedTarget.GetComponent <BuildingComplete>();
        float            num        = (!((Object)component3 != (Object)null)) ? (-1f) : component3.creationTime;
        LogicPorts       component4 = selectedTarget.GetComponent <LogicPorts>();
        EnergyConsumer   component5 = selectedTarget.GetComponent <EnergyConsumer>();
        Operational      component6 = selectedTarget.GetComponent <Operational>();
        Battery          component7 = selectedTarget.GetComponent <Battery>();
        float            num2;
        float            num3;
        float            num4;

        if ((Object)component6 != (Object)null && ((Object)component4 != (Object)null || (Object)component5 != (Object)null || (Object)component7 != (Object)null))
        {
            num2 = component6.GetUptimeForTimeSpan(10f);
            num3 = component6.GetUptimeForTimeSpan(600f);
            num4 = component6.GetUptimeForTimeSpan(6000f);
        }
        else
        {
            num2 = -1f;
            num3 = -1f;
            num4 = -1f;
        }
        drawer.NewLabel(drawer.Format(UI.ELEMENTAL.PRIMARYELEMENT.NAME, element.name)).Tooltip(drawer.Format(UI.ELEMENTAL.PRIMARYELEMENT.TOOLTIP, element.name)).NewLabel(drawer.Format(UI.ELEMENTAL.MASS.NAME, GameUtil.GetFormattedMass(mass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")))
        .Tooltip(drawer.Format(UI.ELEMENTAL.MASS.TOOLTIP, GameUtil.GetFormattedMass(mass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")));
        if (num > 0f)
        {
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.AGE.NAME, Util.FormatTwoDecimalPlace((GameClock.Instance.GetTime() - num) / 600f))).Tooltip(drawer.Format(UI.ELEMENTAL.AGE.TOOLTIP, Util.FormatTwoDecimalPlace((GameClock.Instance.GetTime() - num) / 600f)));
        }
        else
        {
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.AGE.NAME, UI.ELEMENTAL.AGE.UNKNOWN)).Tooltip(UI.ELEMENTAL.AGE.UNKNOWN_TOOLTIP);
        }
        if (num2 >= 0f)
        {
            string text = UI.ELEMENTAL.UPTIME.NAME;
            text = text.Replace("{0}", GameUtil.GetFormattedTime(10f));
            text = text.Replace("{1}", GameUtil.GetFormattedTime(600f));
            text = text.Replace("{2}", GameUtil.GetFormattedTime(6000f));
            text = text.Replace("{3}", GameUtil.GetFormattedPercent(num2 * 100f, GameUtil.TimeSlice.None));
            text = text.Replace("{4}", GameUtil.GetFormattedPercent(num3 * 100f, GameUtil.TimeSlice.None));
            text = text.Replace("{5}", GameUtil.GetFormattedPercent(num4 * 100f, GameUtil.TimeSlice.None));
            drawer.NewLabel(text);
        }
        if (!flag)
        {
            bool     flag2      = false;
            float    num5       = element.thermalConductivity;
            Building component8 = selectedTarget.GetComponent <Building>();
            if ((Object)component8 != (Object)null)
            {
                num5 *= component8.Def.ThermalConductivity;
                flag2 = (component8.Def.ThermalConductivity < 1f);
            }
            string temperatureUnitSuffix = GameUtil.GetTemperatureUnitSuffix();
            float  shc   = specificHeatCapacity * 1f;
            string text2 = string.Format(UI.ELEMENTAL.SHC.NAME, GameUtil.GetDisplaySHC(shc).ToString("0.000"));
            string text3 = UI.ELEMENTAL.SHC.TOOLTIP;
            text3 = text3.Replace("{SPECIFIC_HEAT_CAPACITY}", text2 + GameUtil.GetSHCSuffix());
            text3 = text3.Replace("{TEMPERATURE_UNIT}", temperatureUnitSuffix);
            string text4 = string.Format(UI.ELEMENTAL.THERMALCONDUCTIVITY.NAME, GameUtil.GetDisplayThermalConductivity(num5).ToString("0.000"));
            string text5 = UI.ELEMENTAL.THERMALCONDUCTIVITY.TOOLTIP;
            text5 = text5.Replace("{THERMAL_CONDUCTIVITY}", text4 + GameUtil.GetThermalConductivitySuffix());
            text5 = text5.Replace("{TEMPERATURE_UNIT}", temperatureUnitSuffix);
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.TEMPERATURE.NAME, GameUtil.GetFormattedTemperature(temperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).Tooltip(drawer.Format(UI.ELEMENTAL.TEMPERATURE.TOOLTIP, GameUtil.GetFormattedTemperature(temperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).NewLabel(drawer.Format(UI.ELEMENTAL.DISEASE.NAME, GameUtil.GetFormattedDisease(diseaseIdx, diseaseCount, false)))
            .Tooltip(drawer.Format(UI.ELEMENTAL.DISEASE.TOOLTIP, GameUtil.GetFormattedDisease(diseaseIdx, diseaseCount, true)))
            .NewLabel(text2)
            .Tooltip(text3)
            .NewLabel(text4)
            .Tooltip(text5);
            if (flag2)
            {
                drawer.NewLabel(UI.GAMEOBJECTEFFECTS.INSULATED.NAME).Tooltip(UI.GAMEOBJECTEFFECTS.INSULATED.TOOLTIP);
            }
        }
        if (element.IsSolid)
        {
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.MELTINGPOINT.NAME, GameUtil.GetFormattedTemperature(highTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).Tooltip(drawer.Format(UI.ELEMENTAL.MELTINGPOINT.TOOLTIP, GameUtil.GetFormattedTemperature(highTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
            ElementChunk component9 = selectedTarget.GetComponent <ElementChunk>();
            if ((Object)component9 != (Object)null)
            {
                AttributeModifier attributeModifier = component.Element.attributeModifiers.Find((AttributeModifier m) => m.AttributeId == Db.Get().BuildingAttributes.OverheatTemperature.Id);
                if (attributeModifier != null)
                {
                    drawer.NewLabel(drawer.Format(UI.ELEMENTAL.OVERHEATPOINT.NAME, attributeModifier.GetFormattedString(selectedTarget.gameObject))).Tooltip(drawer.Format(UI.ELEMENTAL.OVERHEATPOINT.TOOLTIP, attributeModifier.GetFormattedString(selectedTarget.gameObject)));
                }
            }
        }
        else if (element.IsLiquid)
        {
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.FREEZEPOINT.NAME, GameUtil.GetFormattedTemperature(lowTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).Tooltip(drawer.Format(UI.ELEMENTAL.FREEZEPOINT.TOOLTIP, GameUtil.GetFormattedTemperature(lowTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).NewLabel(drawer.Format(UI.ELEMENTAL.VAPOURIZATIONPOINT.NAME, GameUtil.GetFormattedTemperature(highTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)))
            .Tooltip(drawer.Format(UI.ELEMENTAL.VAPOURIZATIONPOINT.TOOLTIP, GameUtil.GetFormattedTemperature(highTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
        }
        else if (!flag)
        {
            drawer.NewLabel(drawer.Format(UI.ELEMENTAL.DEWPOINT.NAME, GameUtil.GetFormattedTemperature(lowTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false))).Tooltip(drawer.Format(UI.ELEMENTAL.DEWPOINT.TOOLTIP, GameUtil.GetFormattedTemperature(lowTemp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
        }
        Attributes attributes = selectedTarget.GetAttributes();

        if (attributes != null)
        {
            for (int i = 0; i < attributes.Count; i++)
            {
                AttributeInstance attributeInstance = attributes.AttributeTable[i];
                if (attributeInstance.Attribute.ShowInUI == Attribute.Display.Details || attributeInstance.Attribute.ShowInUI == Attribute.Display.Expectation)
                {
                    drawer.NewLabel(attributeInstance.modifier.Name + ": " + attributeInstance.GetFormattedValue()).Tooltip(attributeInstance.GetAttributeValueTooltip());
                }
            }
        }
        List <Descriptor> detailDescriptors = GameUtil.GetDetailDescriptors(GameUtil.GetAllDescriptors(selectedTarget, false));

        for (int j = 0; j < detailDescriptors.Count; j++)
        {
            Descriptor descriptor = detailDescriptors[j];
            drawer.NewLabel(descriptor.text).Tooltip(descriptor.tooltipText);
        }
    }
            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;
                }
            }
        public void Update(Vector2I min, Vector2I max, Vector3 emitter_position)
        {
            emitterPosition = emitter_position;
            totalTileCount  = 0;
            for (int i = 0; i < allLayers.Count; i++)
            {
                Layer layer = allLayers[i];
                layer.Reset();
            }
            for (int j = min.y; j < max.y; j++)
            {
                if (j % 2 != 1)
                {
                    for (int k = min.x; k < max.x; k++)
                    {
                        if (k % 2 != 0)
                        {
                            int num = Grid.XYToCell(k, j);
                            if (Grid.IsValidCell(num))
                            {
                                totalTileCount++;
                                if (Grid.IsVisible(num))
                                {
                                    if (Grid.GravitasFacility[num])
                                    {
                                        facilityLayer.tileCount += 8;
                                    }
                                    else
                                    {
                                        Element element = Grid.Element[num];
                                        if (element != null)
                                        {
                                            if (element.IsLiquid && Grid.IsSubstantialLiquid(num, 0.35f))
                                            {
                                                AmbienceType ambience = element.substance.GetAmbience();
                                                if (ambience != AmbienceType.None)
                                                {
                                                    liquidLayers[(int)ambience].tileCount++;
                                                    liquidLayers[(int)ambience].averageTemperature += Grid.Temperature[num];
                                                }
                                            }
                                            else if (element.IsGas)
                                            {
                                                AmbienceType ambience2 = element.substance.GetAmbience();
                                                if (ambience2 != AmbienceType.None)
                                                {
                                                    gasLayers[(int)ambience2].tileCount++;
                                                    gasLayers[(int)ambience2].averageTemperature += Grid.Temperature[num];
                                                }
                                            }
                                            else if (element.IsSolid)
                                            {
                                                SolidAmbienceType solidAmbience = element.substance.GetSolidAmbience();
                                                if (Grid.Foundation[num])
                                                {
                                                    solidAmbience = SolidAmbienceType.Tile;
                                                    solidLayers[(int)solidAmbience].tileCount += TuningData <Tuning> .Get().foundationTileValue;

                                                    spaceLayer.tileCount -= TuningData <Tuning> .Get().foundationTileValue;
                                                }
                                                else if ((UnityEngine.Object)Grid.Objects[num, 2] != (UnityEngine.Object)null)
                                                {
                                                    solidAmbience = SolidAmbienceType.Tile;
                                                    solidLayers[(int)solidAmbience].tileCount += TuningData <Tuning> .Get().backwallTileValue;

                                                    spaceLayer.tileCount -= TuningData <Tuning> .Get().backwallTileValue;
                                                }
                                                else if (solidAmbience != SolidAmbienceType.None)
                                                {
                                                    solidLayers[(int)solidAmbience].tileCount++;
                                                }
                                                else if (element.id == SimHashes.Regolith || element.id == SimHashes.MaficRock)
                                                {
                                                    spaceLayer.tileCount++;
                                                }
                                            }
                                            else if (element.id == SimHashes.Vacuum && CellSelectionObject.IsExposedToSpace(num))
                                            {
                                                if ((UnityEngine.Object)Grid.Objects[num, 1] != (UnityEngine.Object)null)
                                                {
                                                    spaceLayer.tileCount -= TuningData <Tuning> .Get().buildingTileValue;
                                                }
                                                spaceLayer.tileCount++;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    fogLayer.tileCount++;
                                }
                            }
                        }
                    }
                }
            }
            Vector2I vector2I   = max - min;
            int      cell_count = vector2I.x * vector2I.y;

            for (int l = 0; l < allLayers.Count; l++)
            {
                Layer layer2 = allLayers[l];
                layer2.UpdatePercentage(cell_count);
            }
            loopingLayers.Sort();
            topLayers.Clear();
            for (int m = 0; m < loopingLayers.Count; m++)
            {
                Layer layer3 = loopingLayers[m];
                if (m < 3 && layer3.tilePercentage > 0f)
                {
                    layer3.Start(emitter_position);
                    layer3.UpdateAverageTemperature();
                    layer3.UpdateParameters(emitter_position);
                    topLayers.Add(layer3);
                }
                else
                {
                    layer3.Stop();
                }
            }
            oneShotLayers.Sort();
            for (int n = 0; n < activeSolidLayerCount; n++)
            {
                if (solidTimers[n].ShouldPlay() && oneShotLayers[n].tilePercentage > 0f)
                {
                    oneShotLayers[n].Start(emitter_position);
                }
            }
        }