public void SetMainEntry(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup)
 {
     if ((UnityEngine.Object)mainRow == (UnityEngine.Object)null)
     {
         mainRow = Util.KInstantiateUI(rowTemplate.gameObject, base.gameObject, true).GetComponent <ReportScreenEntryRow>();
         MultiToggle toggle = mainRow.toggle;
         toggle.onClick = (System.Action)Delegate.Combine(toggle.onClick, new System.Action(ToggleContext));
         MultiToggle componentInChildren = mainRow.name.GetComponentInChildren <MultiToggle>();
         componentInChildren.onClick = (System.Action)Delegate.Combine(componentInChildren.onClick, new System.Action(ToggleContext));
         MultiToggle componentInChildren2 = mainRow.added.GetComponentInChildren <MultiToggle>();
         componentInChildren2.onClick = (System.Action)Delegate.Combine(componentInChildren2.onClick, new System.Action(ToggleContext));
         MultiToggle componentInChildren3 = mainRow.removed.GetComponentInChildren <MultiToggle>();
         componentInChildren3.onClick = (System.Action)Delegate.Combine(componentInChildren3.onClick, new System.Action(ToggleContext));
         MultiToggle componentInChildren4 = mainRow.net.GetComponentInChildren <MultiToggle>();
         componentInChildren4.onClick = (System.Action)Delegate.Combine(componentInChildren4.onClick, new System.Action(ToggleContext));
     }
     mainRow.SetLine(entry, reportGroup);
     currentContextCount = entry.contextEntries.Count;
     for (int i = 0; i < entry.contextEntries.Count; i++)
     {
         if (i >= contextRows.Count)
         {
             ReportScreenEntryRow component = Util.KInstantiateUI(rowTemplate.gameObject, base.gameObject, false).GetComponent <ReportScreenEntryRow>();
             contextRows.Add(component);
         }
         contextRows[i].SetLine(entry.contextEntries[i], reportGroup);
     }
     UpdateVisibility();
 }
    private GameObject CreateOrUpdateLine(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup, bool is_line_active)
    {
        GameObject value = null;

        lineItems.TryGetValue(reportGroup.stringKey, out value);
        if (!is_line_active)
        {
            if ((Object)value != (Object)null && value.activeSelf)
            {
                value.SetActive(false);
            }
        }
        else
        {
            if ((Object)value == (Object)null)
            {
                value      = Util.KInstantiateUI(lineItem, contentFolder, true);
                value.name = "LineItem" + lineItems.Count;
                lineItems[reportGroup.stringKey] = value;
            }
            value.SetActive(true);
            ReportScreenEntry component = value.GetComponent <ReportScreenEntry>();
            component.SetMainEntry(entry, reportGroup);
        }
        return(value);
    }
Exemplo n.º 3
0
        public override bool Success()
        {
            float num = 0f;

            ReportManager.DailyReport todaysReport = ReportManager.Instance.TodaysReport;
            ReportManager.ReportEntry entry        = todaysReport.GetEntry(ReportManager.ReportType.ChoreStatus);
            for (int i = 0; i < entry.contextEntries.Count; i++)
            {
                ReportManager.ReportEntry reportEntry = entry.contextEntries[i];
                if (reportEntry.context == Db.Get().ChoreTypes.PowerTinker.Name)
                {
                    num += reportEntry.Negative;
                }
            }
            for (int j = 0; j < ReportManager.Instance.reports.Count; j++)
            {
                for (int k = 0; k < ReportManager.Instance.reports[j].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries.Count; k++)
                {
                    ReportManager.ReportEntry reportEntry2 = ReportManager.Instance.reports[j].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries[k];
                    if (reportEntry2.context == Db.Get().ChoreTypes.PowerTinker.Name)
                    {
                        num += reportEntry2.Negative;
                    }
                }
            }
            choresCompleted = Math.Abs(num);
            return(Math.Abs(num) >= numChoreseToComplete);
        }
Exemplo n.º 4
0
        static bool Prefix(ref bool __result)
        {
            if (ReportManager.Instance.YesterdaysReport == null || Options.Opts.Mode == Options.OxygenThresholMode.Off)
            {
                __result = true;
                return(false);
            }

            ReportManager.ReportEntry entryYest  = ReportManager.Instance.YesterdaysReport.GetEntry(ReportManager.ReportType.OxygenCreated);
            ReportManager.ReportEntry entryToday = ReportManager.Instance.TodaysReport.GetEntry(ReportManager.ReportType.OxygenCreated);

            switch (Options.Opts.Mode)
            {
            case Options.OxygenThresholMode.Constant:
                __result = entryToday.Net > -Options.Opts.ConstantThreshold || entryYest.Net > 0.0001f;
                break;

            case Options.OxygenThresholMode.Ratio:
                __result = ((entryToday.Positive / -entryToday.Negative) > Options.Opts.RatioThreshold || entryYest.Net > 0.0001f) && GameClock.Instance.GetTimeSinceStartOfCycle() > Options.Opts.TimeDelay;
                break;

            default:
                __result = true;
                break;
            }
            return(false);
        }
Exemplo n.º 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();
        }
    }
        //It may be "FinelyTunedMachine" now, but it will always be "TuneUpForWhat in my heart.
        public static List <string> TuneUpForWhatFormatter(ColonyAchievementStatus cas)
        {
            List <string> outStrings = new List <string>();

            TuneUpGenerator __instance = (TuneUpGenerator)cas.Requirements.Find(s => s is TuneUpGenerator);

            var priv = Traverse.Create(__instance);
            //Sic. This *is* the name of the field. If they fix the typo, it'll need to be fixed here as well.
            float numChores = (float)priv.Field("numChoreseToComplete").GetValue();

            float num = 0.0f;

            ReportManager.ReportEntry entry = ReportManager.Instance.TodaysReport.GetEntry(ReportManager.ReportType.ChoreStatus);
            for (int index = 0; index < entry.contextEntries.Count; ++index)
            {
                ReportManager.ReportEntry contextEntry = entry.contextEntries[index];
                if (contextEntry.context == Db.Get().ChoreTypes.PowerTinker.Name)
                {
                    num += contextEntry.Negative;
                }
            }
            for (int index1 = 0; index1 < ReportManager.Instance.reports.Count; ++index1)
            {
                for (int index2 = 0; index2 < ReportManager.Instance.reports[index1].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries.Count; ++index2)
                {
                    ReportManager.ReportEntry contextEntry = ReportManager.Instance.reports[index1].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries[index2];
                    if (contextEntry.context == Db.Get().ChoreTypes.PowerTinker.Name)
                    {
                        num += contextEntry.Negative;
                    }
                }
            }

            string output = string.Format("Tune Ups: {0} / {1}", (double)Math.Abs(num), (double)numChores);

            outStrings.Add(output);
            return(outStrings);
        }
Exemplo n.º 7
0
 internal SimpleInfoScreenWrapper()
 {
     allGeysers      = null;
     conditionParent = null;
     labelCache      = new Dictionary <string, CachedStorageLabel>(64);
     lastReport      = null;
     lastSelection   = default;
     lastStressEntry = null;
     processHeaders  = new List <ProcessConditionRow>(8);
     processRows     = new List <ProcessConditionRow>(24);
     processVisible  = new List <ProcessConditionRow>(32);
     rocketLabels    = new HashSet <CachedStorageLabel>();
     setInactive     = new HashSet <CachedStorageLabel>();
     statusActive    = false;
     storages        = new List <Storage>(8);
     storageActive   = false;
     storageLabels   = new HashSet <CachedStorageLabel>();
     storageParent   = null;
     stressActive    = false;
     vitalsActive    = false;
     wasPaused       = false;
     instance        = this;
 }
Exemplo n.º 8
0
        public override void OnCleanUp()
        {
            int n = processHeaders.Count;

            allGeysers = null;
            foreach (var pair in labelCache)
            {
                pair.Value.Dispose();
            }
            labelCache.Clear();
            // Avoid leaking the report
            lastReport      = null;
            lastStressEntry = null;
            lastSelection   = default;
            // Destroy all process rows
            for (int i = 0; i < n; i++)
            {
                processHeaders[i].Dispose();
            }
            n = processRows.Count;
            for (int i = 0; i < n; i++)
            {
                processRows[i].Dispose();
            }
            processHeaders.Clear();
            processRows.Clear();
            processVisible.Clear();
            storages.Clear();
            // All of these were in the label cache so they should already be disposed
            rocketLabels.Clear();
            storageLabels.Clear();
            storageParent   = null;
            conditionParent = null;
            instance        = null;
            base.OnCleanUp();
        }
    private void Refresh()
    {
        Debug.Assert(currentReport != null);
        if (currentReport.day == ReportManager.Instance.TodaysReport.day)
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE_TODAY, currentReport.day));
        }
        else if (currentReport.day == ReportManager.Instance.TodaysReport.day - 1)
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE_YESTERDAY, currentReport.day));
        }
        else
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day));
        }
        bool flag = currentReport.day < ReportManager.Instance.TodaysReport.day;

        nextButton.isInteractable = flag;
        if (flag)
        {
            nextButton.GetComponent <ToolTip>().toolTip = string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day + 1);
            nextButton.GetComponent <ToolTip>().enabled = true;
        }
        else
        {
            nextButton.GetComponent <ToolTip>().enabled = false;
        }
        flag = (currentReport.day > 1);
        prevButton.isInteractable = flag;
        if (flag)
        {
            prevButton.GetComponent <ToolTip>().toolTip = string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day - 1);
            prevButton.GetComponent <ToolTip>().enabled = true;
        }
        else
        {
            prevButton.GetComponent <ToolTip>().enabled = false;
        }
        AddSpacer(0);
        int num = 1;

        foreach (KeyValuePair <ReportManager.ReportType, ReportManager.ReportGroup> reportGroup in ReportManager.Instance.ReportGroups)
        {
            ReportManager.ReportEntry entry = currentReport.GetEntry(reportGroup.Key);
            int num2 = num;
            ReportManager.ReportGroup value = reportGroup.Value;
            if (num2 != value.group)
            {
                ReportManager.ReportGroup value2 = reportGroup.Value;
                num = value2.group;
                AddSpacer(num);
            }
            int num3;
            if (entry.accumulate == 0f)
            {
                ReportManager.ReportGroup value3 = reportGroup.Value;
                num3 = (value3.reportIfZero ? 1 : 0);
            }
            else
            {
                num3 = 1;
            }
            bool flag2 = (byte)num3 != 0;
            ReportManager.ReportGroup value4 = reportGroup.Value;
            if (value4.isHeader)
            {
                CreateHeader(reportGroup.Value);
            }
            else if (flag2)
            {
                CreateOrUpdateLine(entry, reportGroup.Value, flag2);
            }
        }
    }
Exemplo n.º 10
0
        /// <summary>
        /// Refreshes the Stress readout of the info screen.
        /// </summary>
        private void RefreshStress()
        {
            var stressDrawer   = sis.stressDrawer;
            var ri             = ReportManager.Instance;
            var allNoteEntries = ri.noteStorage.noteEntries;
            var report         = ri.TodaysReport;
            var stressEntry    = lastStressEntry;
            var stressPanel    = sis.stressPanel;

            if (lastSelection.identity != null)
            {
                // If new report, look up entry again
                if (report != lastReport || stressEntry == null)
                {
                    lastReport      = report;
                    lastStressEntry = stressEntry = report.GetEntry(ReportManager.ReportType.
                                                                    StressDelta);
                }
                string name          = lastSelection.selectable.GetProperName();
                var    stressEntries = stressEntry.contextEntries;
                int    n             = stressEntries.Count;
                stressDrawer.BeginDrawing();
                // Look for this Duplicant in the report
                for (int i = 0; i < n; i++)
                {
                    var reportEntry = stressEntries[i];
                    int nodeID      = reportEntry.noteStorageId;
                    // The IterateNotes callback allocates a delegate on the heap :/
                    if (reportEntry.context == name && allNoteEntries.entries.TryGetValue(
                            nodeID, out Dictionary <NoteEntryKey, float> nodeEntries))
                    {
                        var   text  = CACHED_BUILDER;
                        float total = CompileNotes(nodeEntries, stressDrawer);
                        // Ryu to the rescue again!
                        text.Clear();
                        total.ToRyuHardString(text, 2);
                        string totalText = text.ToString();
                        text.Clear();
                        if (total > 0.0f)
                        {
                            text.Append(UIConstants.ColorPrefixRed);
                        }
                        text.Append(DETAILTABS.DETAILS.NET_STRESS).Replace("{0}", totalText);
                        if (total > 0.0f)
                        {
                            text.Append(UIConstants.ColorSuffix);
                        }
                        stressDrawer.NewLabel(text.ToString());
                        break;
                    }
                }
                stressDrawer.EndDrawing();
                if (!stressActive)
                {
                    sis.stressPanel.SetActive(true);
                    stressActive = true;
                }
            }
            else if (stressActive)
            {
                stressPanel.SetActive(false);
                stressActive = false;
            }
        }
 public RetiredColonyData(string colonyName, int cycleCount, string date, string[] achievements, MinionAssignablesProxy[] minions, BuildingComplete[] buildingCompletes)
 {
     this.colonyName   = colonyName;
     this.cycleCount   = cycleCount;
     this.achievements = achievements;
     this.date         = date;
     Duplicants        = new RetiredDuplicantData[(minions != null) ? minions.Length : 0];
     for (int i = 0; i < Duplicants.Length; i++)
     {
         Duplicants[i]      = new RetiredDuplicantData();
         Duplicants[i].name = minions[i].GetProperName();
         Duplicants[i].age  = (int)Mathf.Floor((float)GameClock.Instance.GetCycle() - minions[i].GetArrivalTime());
         Duplicants[i].skillPointsGained = minions[i].GetTotalSkillpoints();
         Duplicants[i].accessories       = new Dictionary <string, string>();
         if ((Object)minions[i].GetTargetGameObject().GetComponent <Accessorizer>() != (Object)null)
         {
             foreach (ResourceRef <Accessory> accessory in minions[i].GetTargetGameObject().GetComponent <Accessorizer>().GetAccessories())
             {
                 if (accessory.Get() != null)
                 {
                     Duplicants[i].accessories.Add(accessory.Get().slot.Id, accessory.Get().Id);
                 }
             }
         }
         else
         {
             StoredMinionIdentity component = minions[i].GetTargetGameObject().GetComponent <StoredMinionIdentity>();
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Eyes.Id, Db.Get().Accessories.Get(component.bodyData.eyes).Id);
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Arm.Id, Db.Get().Accessories.Get(component.bodyData.arms).Id);
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Body.Id, Db.Get().Accessories.Get(component.bodyData.body).Id);
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Hair.Id, Db.Get().Accessories.Get(component.bodyData.hair).Id);
             if (component.bodyData.hat != HashedString.Invalid)
             {
                 Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Hat.Id, Db.Get().Accessories.Get(component.bodyData.hat).Id);
             }
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.HeadShape.Id, Db.Get().Accessories.Get(component.bodyData.headShape).Id);
             Duplicants[i].accessories.Add(Db.Get().AccessorySlots.Mouth.Id, Db.Get().Accessories.Get(component.bodyData.mouth).Id);
         }
     }
     buildings = new List <Tuple <string, int> >();
     if (buildingCompletes != null)
     {
         foreach (BuildingComplete b in buildingCompletes)
         {
             int num = buildings.FindIndex((Tuple <string, int> match) => (Tag)match.first == b.PrefabID());
             if (num == -1)
             {
                 buildings.Add(new Tuple <string, int>(b.PrefabID().ToString(), 0));
                 num = buildings.Count - 1;
             }
             buildings[num].second++;
         }
     }
     Stats = null;
     Tuple <float, float>[] array   = null;
     Tuple <float, float>[] array2  = null;
     Tuple <float, float>[] array3  = null;
     Tuple <float, float>[] array4  = null;
     Tuple <float, float>[] array5  = null;
     Tuple <float, float>[] array6  = null;
     Tuple <float, float>[] array7  = null;
     Tuple <float, float>[] array8  = null;
     Tuple <float, float>[] array9  = null;
     Tuple <float, float>[] array10 = null;
     Tuple <float, float>[] array11 = null;
     Tuple <float, float>[] array12 = null;
     Tuple <float, float>[] array13 = null;
     Tuple <float, float>[] array14 = null;
     Tuple <float, float>[] array15 = null;
     Tuple <float, float>[] array16 = null;
     if ((Object)ReportManager.Instance != (Object)null)
     {
         array = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int k = 0; k < array.Length; k++)
         {
             array[k] = new Tuple <float, float>((float)ReportManager.Instance.reports[k].day, ReportManager.Instance.reports[k].GetEntry(ReportManager.ReportType.OxygenCreated).accPositive);
         }
         array2 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int l = 0; l < array2.Length; l++)
         {
             array2[l] = new Tuple <float, float>((float)ReportManager.Instance.reports[l].day, ReportManager.Instance.reports[l].GetEntry(ReportManager.ReportType.OxygenCreated).accNegative * -1f);
         }
         array3 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int m = 0; m < array3.Length; m++)
         {
             array3[m] = new Tuple <float, float>((float)ReportManager.Instance.reports[m].day, ReportManager.Instance.reports[m].GetEntry(ReportManager.ReportType.CaloriesCreated).accPositive * 0.001f);
         }
         array4 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int n = 0; n < array4.Length; n++)
         {
             array4[n] = new Tuple <float, float>((float)ReportManager.Instance.reports[n].day, ReportManager.Instance.reports[n].GetEntry(ReportManager.ReportType.CaloriesCreated).accNegative * 0.001f * -1f);
         }
         array5 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num2 = 0; num2 < array5.Length; num2++)
         {
             array5[num2] = new Tuple <float, float>((float)ReportManager.Instance.reports[num2].day, ReportManager.Instance.reports[num2].GetEntry(ReportManager.ReportType.EnergyCreated).accPositive * 0.001f);
         }
         array6 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num3 = 0; num3 < array6.Length; num3++)
         {
             array6[num3] = new Tuple <float, float>((float)ReportManager.Instance.reports[num3].day, ReportManager.Instance.reports[num3].GetEntry(ReportManager.ReportType.EnergyWasted).accNegative * -1f * 0.001f);
         }
         array7 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num4 = 0; num4 < array7.Length; num4++)
         {
             array7[num4] = new Tuple <float, float>((float)ReportManager.Instance.reports[num4].day, ReportManager.Instance.reports[num4].GetEntry(ReportManager.ReportType.WorkTime).accPositive);
         }
         array9 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num5 = 0; num5 < array7.Length; num5++)
         {
             int   num6 = 0;
             float num7 = 0f;
             ReportManager.ReportEntry entry = ReportManager.Instance.reports[num5].GetEntry(ReportManager.ReportType.WorkTime);
             for (int num8 = 0; num8 < entry.contextEntries.Count; num8++)
             {
                 num6++;
                 num7 += entry.contextEntries[num8].accPositive;
             }
             num7        /= (float)num6;
             num7        /= 600f;
             num7        *= 100f;
             array9[num5] = new Tuple <float, float>((float)ReportManager.Instance.reports[num5].day, num7);
         }
         array8 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num9 = 0; num9 < array8.Length; num9++)
         {
             array8[num9] = new Tuple <float, float>((float)ReportManager.Instance.reports[num9].day, ReportManager.Instance.reports[num9].GetEntry(ReportManager.ReportType.TravelTime).accPositive);
         }
         array10 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num10 = 0; num10 < array8.Length; num10++)
         {
             int   num11 = 0;
             float num12 = 0f;
             ReportManager.ReportEntry entry2 = ReportManager.Instance.reports[num10].GetEntry(ReportManager.ReportType.TravelTime);
             for (int num13 = 0; num13 < entry2.contextEntries.Count; num13++)
             {
                 num11++;
                 num12 += entry2.contextEntries[num13].accPositive;
             }
             num12         /= (float)num11;
             num12         /= 600f;
             num12         *= 100f;
             array10[num10] = new Tuple <float, float>((float)ReportManager.Instance.reports[num10].day, num12);
         }
         array11 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num14 = 0; num14 < array7.Length; num14++)
         {
             array11[num14] = new Tuple <float, float>((float)ReportManager.Instance.reports[num14].day, (float)ReportManager.Instance.reports[num14].GetEntry(ReportManager.ReportType.WorkTime).contextEntries.Count);
         }
         array12 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num15 = 0; num15 < array12.Length; num15++)
         {
             int   num16 = 0;
             float num17 = 0f;
             ReportManager.ReportEntry entry3 = ReportManager.Instance.reports[num15].GetEntry(ReportManager.ReportType.StressDelta);
             for (int num18 = 0; num18 < entry3.contextEntries.Count; num18++)
             {
                 num16++;
                 num17 += entry3.contextEntries[num18].accPositive;
             }
             array12[num15] = new Tuple <float, float>((float)ReportManager.Instance.reports[num15].day, num17 / (float)num16);
         }
         array13 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num19 = 0; num19 < array13.Length; num19++)
         {
             int   num20 = 0;
             float num21 = 0f;
             ReportManager.ReportEntry entry4 = ReportManager.Instance.reports[num19].GetEntry(ReportManager.ReportType.StressDelta);
             for (int num22 = 0; num22 < entry4.contextEntries.Count; num22++)
             {
                 num20++;
                 num21 += entry4.contextEntries[num22].accNegative;
             }
             num21         *= -1f;
             array13[num19] = new Tuple <float, float>((float)ReportManager.Instance.reports[num19].day, num21 / (float)num20);
         }
         array14 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num23 = 0; num23 < array14.Length; num23++)
         {
             array14[num23] = new Tuple <float, float>((float)ReportManager.Instance.reports[num23].day, ReportManager.Instance.reports[num23].GetEntry(ReportManager.ReportType.DomesticatedCritters).accPositive);
         }
         array15 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num24 = 0; num24 < array15.Length; num24++)
         {
             array15[num24] = new Tuple <float, float>((float)ReportManager.Instance.reports[num24].day, ReportManager.Instance.reports[num24].GetEntry(ReportManager.ReportType.WildCritters).accPositive);
         }
         array16 = new Tuple <float, float> [ReportManager.Instance.reports.Count];
         for (int num25 = 0; num25 < array16.Length; num25++)
         {
             array16[num25] = new Tuple <float, float>((float)ReportManager.Instance.reports[num25].day, ReportManager.Instance.reports[num25].GetEntry(ReportManager.ReportType.RocketsInFlight).accPositive);
         }
         Stats = new RetiredColonyStatistic[16]
         {
             new RetiredColonyStatistic(DataIDs.OxygenProduced, array, UI.RETIRED_COLONY_INFO_SCREEN.STATS.OXYGEN_CREATED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.MASS.KILOGRAM),
             new RetiredColonyStatistic(DataIDs.OxygenConsumed, array2, UI.RETIRED_COLONY_INFO_SCREEN.STATS.OXYGEN_CONSUMED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.MASS.KILOGRAM),
             new RetiredColonyStatistic(DataIDs.CaloriesProduced, array3, UI.RETIRED_COLONY_INFO_SCREEN.STATS.CALORIES_CREATED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.CALORIES.KILOCALORIE),
             new RetiredColonyStatistic(DataIDs.CaloriesRemoved, array4, UI.RETIRED_COLONY_INFO_SCREEN.STATS.CALORIES_CONSUMED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.CALORIES.KILOCALORIE),
             new RetiredColonyStatistic(DataIDs.PowerProduced, array5, UI.RETIRED_COLONY_INFO_SCREEN.STATS.POWER_CREATED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.ELECTRICAL.KILOJOULE),
             new RetiredColonyStatistic(DataIDs.PowerWasted, array6, UI.RETIRED_COLONY_INFO_SCREEN.STATS.POWER_WASTED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.ELECTRICAL.KILOJOULE),
             new RetiredColonyStatistic(DataIDs.WorkTime, array7, UI.RETIRED_COLONY_INFO_SCREEN.STATS.WORK_TIME, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.SECONDS),
             new RetiredColonyStatistic(DataIDs.AverageWorkTime, array9, UI.RETIRED_COLONY_INFO_SCREEN.STATS.AVERAGE_WORK_TIME, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.PERCENT),
             new RetiredColonyStatistic(DataIDs.TravelTime, array8, UI.RETIRED_COLONY_INFO_SCREEN.STATS.TRAVEL_TIME, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.SECONDS),
             new RetiredColonyStatistic(DataIDs.AverageTravelTime, array10, UI.RETIRED_COLONY_INFO_SCREEN.STATS.AVERAGE_TRAVEL_TIME, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.PERCENT),
             new RetiredColonyStatistic(DataIDs.LiveDuplicants, array11, UI.RETIRED_COLONY_INFO_SCREEN.STATS.LIVE_DUPLICANTS, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.DUPLICANTS),
             new RetiredColonyStatistic(DataIDs.RocketsInFlight, array16, UI.RETIRED_COLONY_INFO_SCREEN.STATS.ROCKET_MISSIONS, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.ROCKET_MISSIONS),
             new RetiredColonyStatistic(DataIDs.AverageStressCreated, array12, UI.RETIRED_COLONY_INFO_SCREEN.STATS.AVERAGE_STRESS_CREATED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.PERCENT),
             new RetiredColonyStatistic(DataIDs.AverageStressRemoved, array13, UI.RETIRED_COLONY_INFO_SCREEN.STATS.AVERAGE_STRESS_REMOVED, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.PERCENT),
             new RetiredColonyStatistic(DataIDs.DomesticatedCritters, array14, UI.RETIRED_COLONY_INFO_SCREEN.STATS.NUMBER_DOMESTICATED_CRITTERS, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.CRITTERS),
             new RetiredColonyStatistic(DataIDs.WildCritters, array15, UI.RETIRED_COLONY_INFO_SCREEN.STATS.NUMBER_WILD_CRITTERS, UI.MATH_PICTURES.AXIS_LABELS.CYCLES, UI.UNITSUFFIXES.CRITTERS)
         };
     }
 }
Exemplo n.º 12
0
    public void SetLine(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup)
    {
        this.entry       = entry;
        this.reportGroup = reportGroup;
        ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .PooledList pos_notes = ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .Allocate();

        entry.IterateNotes(delegate(ReportManager.ReportEntry.Note note)
        {
            if (IsPositiveNote(note))
            {
                pos_notes.Add(note);
            }
        });
        ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .PooledList neg_notes = ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .Allocate();

        entry.IterateNotes(delegate(ReportManager.ReportEntry.Note note)
        {
            if (IsNegativeNote(note))
            {
                neg_notes.Add(note);
            }
        });
        LayoutElement component = name.GetComponent <LayoutElement>();
        float         num3;

        if (entry.context == null)
        {
            num3 = (component.minWidth = (component.preferredWidth = nameWidth));
            if (entry.HasContextEntries())
            {
                toggle.gameObject.SetActive(true);
                spacer.minWidth = groupSpacerWidth;
            }
            else
            {
                toggle.gameObject.SetActive(false);
                spacer.minWidth = groupSpacerWidth + toggle.GetComponent <LayoutElement>().minWidth;
            }
            name.text = reportGroup.stringKey;
        }
        else
        {
            toggle.gameObject.SetActive(false);
            spacer.minWidth = contextSpacerWidth;
            name.text       = entry.context;
            num3            = (component.minWidth = (component.preferredWidth = nameWidth - indentWidth));
            if (base.transform.GetSiblingIndex() % 2 != 0)
            {
                bgImage.color = oddRowColor;
            }
        }
        if (addedValue != entry.Positive)
        {
            string text = reportGroup.formatfn(entry.Positive);
            if (reportGroup.groupFormatfn != null && entry.context == null)
            {
                float num6 = 0f;
                num6 = ((entry.contextEntries.Count <= 0) ? ((float)pos_notes.Count) : ((float)entry.contextEntries.Count));
                num6 = Mathf.Max(num6, 1f);
                text = reportGroup.groupFormatfn(entry.Positive, num6);
            }
            added.text = text;
            addedValue = entry.Positive;
        }
        if (removedValue != entry.Negative)
        {
            string text2 = reportGroup.formatfn(entry.Negative);
            if (reportGroup.groupFormatfn != null && entry.context == null)
            {
                float num7 = 0f;
                num7  = ((entry.contextEntries.Count <= 0) ? ((float)neg_notes.Count) : ((float)entry.contextEntries.Count));
                num7  = Mathf.Max(num7, 1f);
                text2 = reportGroup.groupFormatfn(entry.Negative, num7);
            }
            removed.text = text2;
            removedValue = entry.Negative;
        }
        if (netValue != entry.Net)
        {
            object text3;
            if (reportGroup.formatfn == null)
            {
                num3  = entry.Net;
                text3 = num3.ToString();
            }
            else
            {
                text3 = reportGroup.formatfn(entry.Net);
            }
            string text4 = (string)text3;
            if (reportGroup.groupFormatfn != null && entry.context == null)
            {
                float num8 = 0f;
                num8  = ((entry.contextEntries.Count <= 0) ? ((float)(pos_notes.Count + neg_notes.Count)) : ((float)entry.contextEntries.Count));
                num8  = Mathf.Max(num8, 1f);
                text4 = reportGroup.groupFormatfn(entry.Net, num8);
            }
            net.text = text4;
            netValue = entry.Net;
        }
        pos_notes.Recycle();
        neg_notes.Recycle();
    }