コード例 #1
0
        /// <summary>
        /// Draws the extra descriptors (attributes and details) for the selected object.
        /// </summary>
        /// <param name="drawer">The renderer for the details.</param>
        private void DetailDescriptors(DetailsPanelDrawer drawer)
        {
            var target      = lastSelection.target;
            var attributes  = target.GetAttributes();
            var descriptors = GameUtil.GetAllDescriptors(target);
            int n;

            if (attributes != null)
            {
                n = attributes.Count;
                for (int i = 0; i < n; i++)
                {
                    var instance = attributes.AttributeTable[i];
                    var attr     = instance.Attribute;
                    if (DlcManager.IsDlcListValidForCurrentContent(attr.DLCIds) && (attr.
                                                                                    ShowInUI == Attribute.Display.Details || attr.ShowInUI ==
                                                                                    Attribute.Display.Expectation))
                    {
                        drawer.NewLabel(instance.modifier.Name + ": " + instance.
                                        GetFormattedValue()).Tooltip(instance.GetAttributeValueTooltip());
                    }
                }
            }
            n = descriptors.Count;
            for (int i = 0; i < n; i++)
            {
                var descriptor = descriptors[i];
                if (descriptor.type == Descriptor.DescriptorType.Detail)
                {
                    drawer.NewLabel(descriptor.text).Tooltip(descriptor.tooltipText);
                }
            }
        }
コード例 #2
0
 /// <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));
     }
 }
コード例 #3
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     bioPanel     = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
     traitsPanel  = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
     bioDrawer    = new DetailsPanelDrawer(attributesLabelTemplate, bioPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject);
     traitsDrawer = new DetailsPanelDrawer(attributesLabelTemplate, traitsPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject);
 }
コード例 #4
0
 private static void InitTraitsPanel(SimpleInfoScreen instance)
 {
     if (TraitsPanel == null || LastParent != instance.gameObject)
     {
         TraitsPanel  = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, instance.gameObject);
         TraitsDrawer = new DetailsPanelDrawer(instance.attributesLabelTemplate, TraitsPanel.Content.gameObject);
         LastParent   = instance.gameObject;
     }
 }
コード例 #5
0
    private void RefreshStress()
    {
        MinionIdentity identity = (!((UnityEngine.Object)selectedTarget != (UnityEngine.Object)null)) ? null : selectedTarget.GetComponent <MinionIdentity>();

        if ((UnityEngine.Object)identity == (UnityEngine.Object)null)
        {
            stressPanel.SetActive(false);
        }
        else
        {
            List <ReportManager.ReportEntry.Note> stressNotes = new List <ReportManager.ReportEntry.Note>();
            stressPanel.SetActive(true);
            stressPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.STATS.GROUPNAME_STRESS;
            ReportManager.ReportEntry reportEntry = ReportManager.Instance.TodaysReport.reportEntries.Find((ReportManager.ReportEntry entry) => entry.reportType == ReportManager.ReportType.StressDelta);
            stressDrawer.BeginDrawing();
            float num = 0f;
            stressNotes.Clear();
            int num2 = reportEntry.contextEntries.FindIndex((ReportManager.ReportEntry entry) => entry.context == identity.GetProperName());
            ReportManager.ReportEntry reportEntry2 = (num2 == -1) ? null : reportEntry.contextEntries[num2];
            if (reportEntry2 != null)
            {
                reportEntry2.IterateNotes(delegate(ReportManager.ReportEntry.Note note)
                {
                    stressNotes.Add(note);
                });
                stressNotes.Sort((ReportManager.ReportEntry.Note a, ReportManager.ReportEntry.Note b) => a.value.CompareTo(b.value));
                for (int i = 0; i < stressNotes.Count; i++)
                {
                    DetailsPanelDrawer             detailsPanelDrawer = stressDrawer;
                    string[]                       obj   = new string[6];
                    ReportManager.ReportEntry.Note note2 = stressNotes[i];
                    obj[0] = ((!(note2.value > 0f)) ? string.Empty : UIConstants.ColorPrefixRed);
                    ReportManager.ReportEntry.Note note3 = stressNotes[i];
                    obj[1] = note3.note;
                    obj[2] = ": ";
                    ReportManager.ReportEntry.Note note4 = stressNotes[i];
                    obj[3] = Util.FormatTwoDecimalPlace(note4.value);
                    obj[4] = "%";
                    ReportManager.ReportEntry.Note note5 = stressNotes[i];
                    obj[5] = ((!(note5.value > 0f)) ? string.Empty : UIConstants.ColorSuffix);
                    detailsPanelDrawer.NewLabel(string.Concat(obj));
                    float num3 = num;
                    ReportManager.ReportEntry.Note note6 = stressNotes[i];
                    num = num3 + note6.value;
                }
            }
            stressDrawer.NewLabel(((!(num > 0f)) ? string.Empty : UIConstants.ColorPrefixRed) + string.Format(UI.DETAILTABS.DETAILS.NET_STRESS, Util.FormatTwoDecimalPlace(num)) + ((!(num > 0f)) ? string.Empty : UIConstants.ColorSuffix));
            stressDrawer.EndDrawing();
        }
    }
コード例 #6
0
        /// <summary>
        /// Draws the building's creation time, or nothing if the data is not available.
        /// </summary>
        /// <param name="drawer">The renderer for the details.</param>
        /// <param name="changed">true if the target changed, or false otherwise.</param>
        private void AddCreationTime(DetailsPanelDrawer drawer, bool changed)
        {
            var   bc = lastSelection.buildingComplete;
            float creationTime;

            if (bc != null && (creationTime = bc.creationTime) > 0.0f)
            {
                string time = lastSelection.creationTimeCached;
                if (changed || time == null)
                {
                    time = Util.FormatTwoDecimalPlace((GameClock.Instance.GetTime() -
                                                       creationTime) / Constants.SECONDS_PER_CYCLE);
                    lastSelection.creationTimeCached = time;
                }
                drawer.NewLabel(drawer.Format(ELEMENTAL.AGE.NAME, time)).Tooltip(
                    drawer.Format(ELEMENTAL.AGE.TOOLTIP, time));
            }
        }
コード例 #7
0
        /// <summary>
        /// Draws the thermal properties of the constituent element.
        /// </summary>
        /// <param name="drawer">The renderer for the details.</param>
        private void AddElementInfo(DetailsPanelDrawer drawer)
        {
            string tempStr      = GameUtil.GetFormattedTemperature(lastSelection.Temperature);
            byte   diseaseIdx   = lastSelection.DiseaseIndex;
            int    diseaseCount = lastSelection.DiseaseCount;

            drawer.NewLabel(drawer.Format(ELEMENTAL.TEMPERATURE.NAME, tempStr)).
            Tooltip(drawer.Format(ELEMENTAL.TEMPERATURE.TOOLTIP, tempStr)).
            NewLabel(drawer.Format(ELEMENTAL.DISEASE.NAME, GameUtil.
                                   GetFormattedDisease(diseaseIdx, diseaseCount, false))).
            Tooltip(drawer.Format(ELEMENTAL.DISEASE.TOOLTIP, GameUtil.GetFormattedDisease(
                                      diseaseIdx, diseaseCount, true)));
            lastSelection.specificHeat.AddLine(drawer);
            lastSelection.thermalConductivity.AddLine(drawer);
            if (lastSelection.insulator)
            {
                drawer.NewLabel(STRINGS.UI.GAMEOBJECTEFFECTS.INSULATED.NAME).Tooltip(
                    STRINGS.UI.GAMEOBJECTEFFECTS.INSULATED.TOOLTIP);
            }
        }
コード例 #8
0
        /// <summary>
        /// Collects the stress change reasons and displays them in the UI.
        /// </summary>
        /// <param name="stressEntries">The stress change entries in the report entry.</param>
        /// <param name="stressDrawer">The renderer for this info screen.</param>
        /// <returns>The total stress change.</returns>
        private static float CompileNotes(Dictionary <NoteEntryKey, float> stressEntries,
                                          DetailsPanelDrawer stressDrawer)
        {
            var stringTable = ReportManager.Instance.noteStorage.stringTable;
            var stressNotes = ListPool <ReportEntry.Note, SimpleInfoScreen> .Allocate();

            string pct   = STRINGS.UI.UNITSUFFIXES.PERCENT;
            var    text  = CACHED_BUILDER;
            int    n     = stressEntries.Count;
            float  total = 0.0f;

            foreach (var pair in stressEntries)
            {
                string hash = stringTable.GetStringByHash(pair.Key.noteHash);
                stressNotes.Add(new ReportEntry.Note(pair.Value, hash));
            }
            stressNotes.Sort(StressNoteComparer.Instance);
            for (int i = 0; i < n; i++)
            {
                var   note        = stressNotes[i];
                float stressDelta = note.value;
                text.Clear();
                if (stressDelta > 0.0f)
                {
                    text.Append(UIConstants.ColorPrefixRed);
                }
                text.Append(note.note).Append(": ");
                stressDelta.ToRyuHardString(text, 2);
                text.Append(pct);
                if (stressDelta > 0.0f)
                {
                    text.Append(UIConstants.ColorSuffix);
                }
                stressDrawer.NewLabel(text.ToString());
                total += stressDelta;
            }
            stressNotes.Recycle();
            return(total);
        }
コード例 #9
0
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        statusItemPanel = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        statusItemPanel.Content.GetComponent <VerticalLayoutGroup>().padding.bottom = 10;
        statusItemPanel.HeaderLabel.text     = UI.DETAILTABS.SIMPLEINFO.GROUPNAME_STATUS;
        statusItemPanel.scalerMask.hoverLock = true;
        statusItemsFolder = statusItemPanel.Content.gameObject;
        vitalsPanel       = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        vitalsPanel.SetTitle(UI.DETAILTABS.SIMPLEINFO.GROUPNAME_CONDITION);
        vitalsContainer = Util.KInstantiateUI(VitalsPanelTemplate, vitalsPanel.Content.gameObject, false).GetComponent <MinionVitalsPanel>();
        fertilityPanel  = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        fertilityPanel.SetTitle(UI.DETAILTABS.SIMPLEINFO.GROUPNAME_FERTILITY);
        infoPanel = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        infoPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.SIMPLEINFO.GROUPNAME_DESCRIPTION;
        GameObject gameObject = infoPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject;

        descriptionContainer = Util.KInstantiateUI <DescriptionContainer>(DescriptionContainerTemplate, gameObject, false);
        storagePanel         = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        stressPanel          = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false);
        stressDrawer         = new DetailsPanelDrawer(attributesLabelTemplate, stressPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject);
        stampContainer       = Util.KInstantiateUI(StampContainerTemplate, gameObject, false);
        Subscribe(-1514841199, OnRefreshDataDelegate);
    }
コード例 #10
0
        /// <summary>
        /// Draws the uptime statistics of the building if available.
        /// </summary>
        /// <param name="drawer">The renderer for the details.</param>
        /// <param name="changed">true if the target changed, or false otherwise.</param>
        private void AddUptimeStats(DetailsPanelDrawer drawer, bool changed)
        {
            var   operational = lastSelection.operational;
            float thisCycle;

            if (operational != null && lastSelection.showUptime && (thisCycle = operational.
                                                                                GetCurrentCycleUptime()) >= 0.0f)
            {
                float lastCycle = operational.GetLastCycleUptime(), prevCycles =
                    operational.GetUptimeOverCycles(NUM_CYCLES);
                string label = lastSelection.uptimeCached;
                if (changed || label == null)
                {
                    var text = CACHED_BUILDER;
                    label = text.Clear().Append(uptimeStr).
                            Replace("{0}", GameUtil.GetFormattedPercent(thisCycle * 100.0f)).
                            Replace("{1}", GameUtil.GetFormattedPercent(lastCycle * 100.0f)).
                            Replace("{2}", GameUtil.GetFormattedPercent(prevCycles * 100.0f)).
                            ToString();
                    lastSelection.uptimeCached = label;
                }
                drawer.NewLabel(label);
            }
        }
コード例 #11
0
 /// <summary>
 /// Adds this info descriptor to the details screen.
 /// </summary>
 /// <param name="drawer">The renderer for the details.</param>
 public void AddLine(DetailsPanelDrawer drawer)
 {
     drawer.NewLabel(text).Tooltip(tooltip);
 }