public override IEnumerable <StatDrawEntry> SpecialDisplayStats(StatRequest req)
        {
            using (IEnumerator <StatDrawEntry> enumerator = base.SpecialDisplayStats(req).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    StatDrawEntry s = enumerator.Current;
                    yield return(s);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (((ThingDef)req.Def).building.IsTurret)
            {
                StatCategoryDef building           = StatCategoryDefOf.Building;
                string          label              = "RearmCost".Translate();
                string          valueString        = GenLabel.ThingLabel(fuelFilter.AnyAllowedDef, null, (int)(fuelCapacity / FuelMultiplierCurrentDifficulty)).CapitalizeFirst();
                string          overrideReportText = "RearmCostExplanation".Translate();
                yield return(new StatDrawEntry(building, label, valueString, 0, overrideReportText));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield break;
IL_01be:
            /*Error near IL_01bf: Unexpected return in MoveNext()*/;
        }
 public static void Reset()
 {
     StatsReportUtility.scrollPosition  = default(Vector2);
     StatsReportUtility.selectedEntry   = null;
     StatsReportUtility.mousedOverEntry = null;
     StatsReportUtility.cachedDrawEntries.Clear();
 }
Esempio n. 3
0
        internal IEnumerable <StatDrawEntry> SpecialDisplayStats(ThingDef parentDef)
        {
            if (!parentDef.IsCorpse)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Nutrition".Translate(), this.nutrition.ToString("0.##"), 0, string.Empty));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (this.joy > 0.0)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Joy".Translate(), this.joy.ToStringPercent("F2") + " (" + this.JoyKind.label + ")", 0, string.Empty));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (this.outcomeDoers != null)
            {
                for (int i = 0; i < this.outcomeDoers.Count; i++)
                {
                    using (IEnumerator <StatDrawEntry> enumerator = this.outcomeDoers[i].SpecialDisplayStats(parentDef).GetEnumerator())
                    {
                        if (enumerator.MoveNext())
                        {
                            StatDrawEntry s = enumerator.Current;
                            yield return(s);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                }
            }
            yield break;
IL_01f2:
            /*Error near IL_01f3: Unexpected return in MoveNext()*/;
        }
Esempio n. 4
0
        internal IEnumerable <StatDrawEntry> SpecialDisplayStats()
        {
            if (joy > 0f)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Joy".Translate(), joy.ToStringPercent("F2") + " (" + JoyKind.label + ")", 0, string.Empty));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (outcomeDoers != null)
            {
                for (int i = 0; i < outcomeDoers.Count; i++)
                {
                    using (IEnumerator <StatDrawEntry> enumerator = outcomeDoers[i].SpecialDisplayStats(parent).GetEnumerator())
                    {
                        if (enumerator.MoveNext())
                        {
                            StatDrawEntry s = enumerator.Current;
                            yield return(s);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                }
            }
            yield break;
IL_019a:
            /*Error near IL_019b: Unexpected return in MoveNext()*/;
        }
        private static StatDrawEntry DescriptionEntry(WorldObject worldObject)
        {
            StatDrawEntry statDrawEntry = new StatDrawEntry(StatCategoryDefOf.Basics, "Description".Translate(), string.Empty, 99999, string.Empty);

            statDrawEntry.overrideReportText = worldObject.GetDescription();
            return(statDrawEntry);
        }
Esempio n. 6
0
 public static void Reset()
 {
     scrollPosition  = default(Vector2);
     selectedEntry   = null;
     mousedOverEntry = null;
     cachedDrawEntries.Clear();
 }
        private static StatDrawEntry DescriptionEntry(Def def)
        {
            StatDrawEntry statDrawEntry = new StatDrawEntry(StatCategoryDefOf.Basics, "Description".Translate(), string.Empty, 99999, string.Empty);

            statDrawEntry.overrideReportText = def.description;
            return(statDrawEntry);
        }
Esempio n. 8
0
        private static StatDrawEntry DescriptionEntry(Thing thing)
        {
            StatDrawEntry statDrawEntry = new StatDrawEntry(StatCategoryDefOf.Basics, "Description".Translate(), string.Empty, 99999, string.Empty);

            statDrawEntry.overrideReportText = thing.DescriptionFlavor;
            return(statDrawEntry);
        }
 private static void SelectEntry(StatDrawEntry rec, bool playSound = true)
 {
     StatsReportUtility.selectedEntry = rec;
     if (playSound)
     {
         SoundDefOf.TickHigh.PlayOneShotOnCamera(null);
     }
 }
Esempio n. 10
0
 private static void SelectEntry(StatDrawEntry rec, bool playSound = true)
 {
     selectedEntry = rec;
     if (playSound)
     {
         SoundDefOf.Tick_High.PlayOneShotOnCamera();
     }
 }
Esempio n. 11
0
 public static void Reset()
 {
     scrollPosition           = default(Vector2);
     scrollPositionRightPanel = default(Vector2);
     selectedEntry            = null;
     mousedOverEntry          = null;
     cachedDrawEntries.Clear();
     PermitsCardUtility.selectedPermit  = null;
     PermitsCardUtility.selectedFaction = Find.FactionManager.AllFactions.FirstOrDefault((Faction x) => x.def.HasRoyalTitles);
 }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    if (!parentDef.IsDrug || this.chance < 1f)
                    {
                        goto IL_E0;
                    }
                    enumerator = this.hediffDef.SpecialDisplayStats().GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        s             = enumerator.Current;
                        this.$current = s;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
IL_E0:
                this.$PC = -1;
                return(false);
            }
Esempio n. 13
0
        private static StatDrawEntry QualityEntry(Thing t)
        {
            if (!t.TryGetQuality(out QualityCategory qc))
            {
                return(null);
            }
            StatDrawEntry statDrawEntry = new StatDrawEntry(StatCategoryDefOf.Basics, "Quality".Translate(), qc.GetLabel().CapitalizeFirst(), 99999, string.Empty);

            statDrawEntry.overrideReportText = "QualityDescription".Translate();
            return(statDrawEntry);
        }
Esempio n. 14
0
        private static IEnumerable <StatDrawEntry> StatsToDraw(Thing thing)
        {
            yield return(DescriptionEntry(thing));

            StatDrawEntry statDrawEntry = QualityEntry(thing);

            if (statDrawEntry != null)
            {
                yield return(statDrawEntry);
            }
            foreach (StatDef item in DefDatabase <StatDef> .AllDefs.Where((StatDef st) => st.Worker.ShouldShowFor(StatRequest.For(thing))))
            {
                if (!item.Worker.IsDisabledFor(thing))
                {
                    float statValue = thing.GetStatValue(item);
                    if (item.showOnDefaultValue || statValue != item.defaultBaseValue)
                    {
                        yield return(new StatDrawEntry(item.category, item, statValue, StatRequest.For(thing)));
                    }
                }
                else
                {
                    yield return(new StatDrawEntry(item.category, item));
                }
            }
            if (thing.def.useHitPoints)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.BasicsImportant, "HitPointsBasic".Translate().CapitalizeFirst(), thing.HitPoints.ToString() + " / " + thing.MaxHitPoints.ToString(), "Stat_HitPoints_Desc".Translate(), 99998));
            }
            foreach (StatDrawEntry item2 in thing.SpecialDisplayStats())
            {
                yield return(item2);
            }
            if (!thing.def.IsStuff)
            {
                yield break;
            }
            if (!thing.def.stuffProps.statFactors.NullOrEmpty())
            {
                for (int j = 0; j < thing.def.stuffProps.statFactors.Count; j++)
                {
                    yield return(new StatDrawEntry(StatCategoryDefOf.StuffStatFactors, thing.def.stuffProps.statFactors[j].stat, thing.def.stuffProps.statFactors[j].value, StatRequest.ForEmpty(), ToStringNumberSense.Factor));
                }
            }
            if (!thing.def.stuffProps.statOffsets.NullOrEmpty())
            {
                for (int j = 0; j < thing.def.stuffProps.statOffsets.Count; j++)
                {
                    yield return(new StatDrawEntry(StatCategoryDefOf.StuffStatOffsets, thing.def.stuffProps.statOffsets[j].stat, thing.def.stuffProps.statOffsets[j].value, StatRequest.ForEmpty(), ToStringNumberSense.Offset));
                }
            }
        }
Esempio n. 15
0
        private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject)
        {
            Rect rect2 = new Rect(rect);

            rect2.width *= 0.5f;
            Rect rect3 = new Rect(rect);

            rect3.x     = rect2.xMax;
            rect3.width = rect.xMax - rect3.x;
            Text.Font   = GameFont.Small;
            Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, listHeight);

            Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect);
            float  curY = 0f;
            string b    = null;

            mousedOverEntry = null;
            for (int i = 0; i < cachedDrawEntries.Count; i++)
            {
                StatDrawEntry ent = cachedDrawEntries[i];
                if (ent.category.LabelCap != b)
                {
                    Widgets.ListSeparator(ref curY, viewRect.width, ent.category.LabelCap);
                    b = ent.category.LabelCap;
                }
                curY += ent.Draw(8f, curY, viewRect.width - 8f, selectedEntry == ent, delegate
                {
                    SelectEntry(ent);
                }, delegate
                {
                    mousedOverEntry = ent;
                }, scrollPosition, rect2);
            }
            listHeight = curY + 100f;
            Widgets.EndScrollView();
            Rect rect4 = rect3.ContractedBy(10f);

            GUI.BeginGroup(rect4);
            StatDrawEntry statDrawEntry = selectedEntry ?? mousedOverEntry ?? cachedDrawEntries.FirstOrDefault();

            if (statDrawEntry != null)
            {
                StatRequest optionalReq     = statDrawEntry.hasOptionalReq ? statDrawEntry.optionalReq : ((optionalThing == null) ? StatRequest.ForEmpty() : StatRequest.For(optionalThing));
                string      explanationText = statDrawEntry.GetExplanationText(optionalReq);
                Rect        rect5           = rect4.AtZero();
                Widgets.Label(rect5, explanationText);
            }
            GUI.EndGroup();
        }
        private static StatDrawEntry QualityEntry(Thing t)
        {
            QualityCategory cat;
            StatDrawEntry   result;

            if (!t.TryGetQuality(out cat))
            {
                result = null;
            }
            else
            {
                result = new StatDrawEntry(StatCategoryDefOf.Basics, "Quality".Translate(), cat.GetLabel().CapitalizeFirst(), 99999, "")
                {
                    overrideReportText = "QualityDescription".Translate()
                };
            }
            return(result);
        }
Esempio n. 17
0
        public override IEnumerable <StatDrawEntry> SpecialDisplayStats(ThingDef parentDef)
        {
            if (parentDef.IsDrug && chance >= 1f)
            {
                using (IEnumerator <StatDrawEntry> enumerator = hediffDef.SpecialDisplayStats(StatRequest.ForEmpty()).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        StatDrawEntry s = enumerator.Current;
                        yield return(s);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            yield break;
IL_00e8:
            /*Error near IL_00e9: Unexpected return in MoveNext()*/;
        }
			public bool MoveNext()
			{
				uint num = (uint)this.$PC;
				this.$PC = -1;
				switch (num)
				{
				case 0u:
					this.$current = new StatDrawEntry(StatCategoryDefOf.Basics, this.need.LabelCap, this.offset.ToStringPercent(), 0, "");
					if (!this.$disposing)
					{
						this.$PC = 1;
					}
					return true;
				case 1u:
					this.$PC = -1;
					break;
				}
				return false;
			}
Esempio n. 19
0
        private static IEnumerable <StatDrawEntry> StatsToDraw(Thing thing)
        {
            yield return(DescriptionEntry(thing));

            StatDrawEntry statDrawEntry = QualityEntry(thing);

            if (statDrawEntry != null)
            {
                yield return(statDrawEntry);
            }
            foreach (StatDef item in DefDatabase <StatDef> .AllDefs.Where((StatDef st) => st.Worker.ShouldShowFor(StatRequest.For(thing))))
            {
                if (!item.Worker.IsDisabledFor(thing))
                {
                    float statValue = thing.GetStatValue(item);
                    if (item.showOnDefaultValue || statValue != item.defaultBaseValue)
                    {
                        yield return(new StatDrawEntry(item.category, item, statValue, StatRequest.For(thing)));
                    }
                }
                else
                {
                    yield return(new StatDrawEntry(item.category, item));
                }
            }
            if (thing.def.useHitPoints)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.BasicsImportant, "HitPointsBasic".Translate().CapitalizeFirst(), thing.HitPoints + " / " + thing.MaxHitPoints, "Stat_HitPoints_Desc".Translate(), 99998));
            }
            foreach (StatDrawEntry item2 in thing.SpecialDisplayStats())
            {
                yield return(item2);
            }
            if (!thing.def.IsStuff)
            {
                yield break;
            }
            foreach (StatDrawEntry item3 in StuffStats(thing.def))
            {
                yield return(item3);
            }
        }
        public override IEnumerable <StatDrawEntry> SpecialDisplayStats()
        {
            using (IEnumerator <StatDrawEntry> enumerator = base.SpecialDisplayStats().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    StatDrawEntry s = enumerator.Current;
                    yield return(s);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (!this.Addictive)
            {
                yield break;
            }
            yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Addictiveness".Translate(), this.addictiveness.ToStringPercent(), 0, string.Empty));

            /*Error: Unable to find new state assignment for yield return*/;
IL_0111:
            /*Error near IL_0112: Unexpected return in MoveNext()*/;
        }
Esempio n. 21
0
        public override IEnumerable <StatDrawEntry> SpecialDisplayStats(StatRequest req)
        {
            using (IEnumerator <StatDrawEntry> enumerator = base.SpecialDisplayStats(req).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    StatDrawEntry s = enumerator.Current;
                    yield return(s);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (basePowerConsumption > 0f)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Building, "PowerConsumption".Translate(), basePowerConsumption.ToString("F0") + " W", 0, string.Empty));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield break;
IL_012b:
            /*Error near IL_012c: Unexpected return in MoveNext()*/;
        }
Esempio n. 22
0
        private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject)
        {
            Rect rect2 = new Rect(rect);

            rect2.width *= 0.5f;
            Rect rect3 = new Rect(rect);

            rect3.x     = rect2.xMax;
            rect3.width = rect.xMax - rect3.x;
            Text.Font   = GameFont.Small;
            Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, listHeight);

            Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect);
            float  curY = 0f;
            string b    = null;

            mousedOverEntry = null;
            for (int i = 0; i < cachedDrawEntries.Count; i++)
            {
                StatDrawEntry ent = cachedDrawEntries[i];
                if ((string)ent.category.LabelCap != b)
                {
                    Widgets.ListSeparator(ref curY, viewRect.width, ent.category.LabelCap);
                    b = ent.category.LabelCap;
                }
                curY += ent.Draw(8f, curY, viewRect.width - 8f, selectedEntry == ent, delegate
                {
                    SelectEntry(ent);
                }, delegate
                {
                    mousedOverEntry = ent;
                }, scrollPosition, rect2);
            }
            listHeight = curY + 100f;
            Widgets.EndScrollView();
            Rect          outRect       = rect3.ContractedBy(10f);
            StatDrawEntry statDrawEntry = selectedEntry ?? mousedOverEntry ?? cachedDrawEntries.FirstOrDefault();

            if (statDrawEntry != null)
            {
                Rect        rect4           = new Rect(0f, 0f, outRect.width - 16f, rightPanelHeight);
                StatRequest statRequest     = statDrawEntry.hasOptionalReq ? statDrawEntry.optionalReq : ((optionalThing == null) ? StatRequest.ForEmpty() : StatRequest.For(optionalThing));
                string      explanationText = statDrawEntry.GetExplanationText(statRequest);
                float       num             = 0f;
                Widgets.BeginScrollView(outRect, ref scrollPositionRightPanel, rect4);
                Rect rect5 = rect4;
                rect5.width -= 4f;
                Widgets.Label(rect5, explanationText);
                float num2 = Text.CalcHeight(explanationText, rect5.width) + 10f;
                num += num2;
                IEnumerable <Dialog_InfoCard.Hyperlink> hyperlinks = statDrawEntry.GetHyperlinks(statRequest);
                if (hyperlinks != null)
                {
                    Rect  rect6 = new Rect(rect5.x, rect5.y + num2, rect5.width, rect5.height - num2);
                    Color color = GUI.color;
                    GUI.color = Widgets.NormalOptionColor;
                    foreach (Dialog_InfoCard.Hyperlink item in hyperlinks)
                    {
                        float num3 = Text.CalcHeight(item.Label, rect6.width);
                        Widgets.HyperlinkWithIcon(new Rect(rect6.x, rect6.y, rect6.width, num3), item, "ViewHyperlink".Translate(item.Label));
                        rect6.y      += num3;
                        rect6.height -= num3;
                        num          += num3;
                    }
                    GUI.color = color;
                }
                rightPanelHeight = num;
                Widgets.EndScrollView();
            }
        }
        private static IEnumerable <StatDrawEntry> StatsToDraw(Thing thing)
        {
            yield return(StatsReportUtility.DescriptionEntry(thing));

            StatDrawEntry qe = StatsReportUtility.QualityEntry(thing);

            if (qe != null)
            {
                yield return(qe);
            }
            foreach (StatDef stat in from st in DefDatabase <StatDef> .AllDefs
                     where st.Worker.ShouldShowFor(StatRequest.For(thing))
                     select st)
            {
                if (!stat.Worker.IsDisabledFor(thing))
                {
                    yield return(new StatDrawEntry(stat.category, stat, thing.GetStatValue(stat, true), StatRequest.For(thing), ToStringNumberSense.Undefined));
                }
                else
                {
                    yield return(new StatDrawEntry(stat.category, stat));
                }
            }
            if (thing.def.useHitPoints)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.BasicsNonPawn, "HitPointsBasic".Translate().CapitalizeFirst(), thing.HitPoints.ToString() + " / " + thing.MaxHitPoints.ToString(), 0, "")
                {
                    overrideReportText = string.Concat(new string[]
                    {
                        "HitPointsBasic".Translate().CapitalizeFirst(),
                        ":\n\n",
                        thing.HitPoints.ToString(),
                        "\n\n",
                        StatDefOf.MaxHitPoints.LabelCap,
                        ":\n\n",
                        StatDefOf.MaxHitPoints.Worker.GetExplanationUnfinalized(StatRequest.For(thing), ToStringNumberSense.Absolute)
                    })
                });
            }
            foreach (StatDrawEntry stat2 in thing.SpecialDisplayStats())
            {
                yield return(stat2);
            }
            if (!thing.def.equippedStatOffsets.NullOrEmpty <StatModifier>())
            {
                for (int i = 0; i < thing.def.equippedStatOffsets.Count; i++)
                {
                    yield return(new StatDrawEntry(StatCategoryDefOf.EquippedStatOffsets, thing.def.equippedStatOffsets[i].stat, thing.def.equippedStatOffsets[i].value, StatRequest.ForEmpty(), ToStringNumberSense.Offset));
                }
            }
            if (thing.def.IsStuff)
            {
                if (!thing.def.stuffProps.statFactors.NullOrEmpty <StatModifier>())
                {
                    for (int j = 0; j < thing.def.stuffProps.statFactors.Count; j++)
                    {
                        yield return(new StatDrawEntry(StatCategoryDefOf.StuffStatFactors, thing.def.stuffProps.statFactors[j].stat, thing.def.stuffProps.statFactors[j].value, StatRequest.ForEmpty(), ToStringNumberSense.Factor));
                    }
                }
                if (!thing.def.stuffProps.statOffsets.NullOrEmpty <StatModifier>())
                {
                    for (int k = 0; k < thing.def.stuffProps.statOffsets.Count; k++)
                    {
                        yield return(new StatDrawEntry(StatCategoryDefOf.StuffStatOffsets, thing.def.stuffProps.statOffsets[k].stat, thing.def.stuffProps.statOffsets[k].value, StatRequest.ForEmpty(), ToStringNumberSense.Offset));
                    }
                }
            }
            yield break;
        }
 private static string <FinalizeCachedDrawEntries> m__7(StatDrawEntry sd)
 {
     return(sd.LabelCap);
 }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    this.$current = StatsReportUtility.DescriptionEntry(def);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                {
                    eDef = (def as BuildableDef);
                    if (eDef == null)
                    {
                        goto IL_179;
                    }
                    StatRequest statRequest = StatRequest.For(eDef, stuff, QualityCategory.Normal);
                    enumerator = (from st in DefDatabase <StatDef> .AllDefs
                                  where st.Worker.ShouldShowFor(statRequest)
                                  select st).GetEnumerator();
                    num = 4294967293u;
                    break;
                }

                case 2u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        stat          = enumerator.Current;
                        this.$current = new StatDrawEntry(stat.category, stat, eDef.GetStatValueAbstract(stat, stuff), StatRequest.For(eDef, stuff, QualityCategory.Normal), ToStringNumberSense.Undefined);
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
IL_179:
                this.$PC = -1;
                return(false);
            }
 private static int <FinalizeCachedDrawEntries> m__6(StatDrawEntry sd)
 {
     return(sd.DisplayPriorityWithinCategory);
 }
 private static int <FinalizeCachedDrawEntries> m__5(StatDrawEntry sd)
 {
     return(sd.category.displayOrder);
 }
 private static bool <DrawStatsReport> m__4(StatDrawEntry de)
 {
     return(de.stat != null && !de.stat.showNonAbstract);
 }
 private static bool <DrawStatsReport> m__3(StatDrawEntry r)
 {
     return(r.ShouldDisplay);
 }
        private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject)
        {
            Rect rect2 = new Rect(rect);

            rect2.width *= 0.5f;
            Rect rect3 = new Rect(rect);

            rect3.x     = rect2.xMax;
            rect3.width = rect.xMax - rect3.x;
            Text.Font   = GameFont.Small;
            Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, StatsReportUtility.listHeight);

            Widgets.BeginScrollView(rect2, ref StatsReportUtility.scrollPosition, viewRect, true);
            float  num = 0f;
            string b   = null;

            StatsReportUtility.mousedOverEntry = null;
            for (int i = 0; i < StatsReportUtility.cachedDrawEntries.Count; i++)
            {
                StatDrawEntry ent = StatsReportUtility.cachedDrawEntries[i];
                if (ent.category.LabelCap != b)
                {
                    Widgets.ListSeparator(ref num, viewRect.width, ent.category.LabelCap);
                    b = ent.category.LabelCap;
                }
                num += ent.Draw(8f, num, viewRect.width - 8f, StatsReportUtility.selectedEntry == ent, delegate
                {
                    StatsReportUtility.SelectEntry(ent, true);
                }, delegate
                {
                    StatsReportUtility.mousedOverEntry = ent;
                }, StatsReportUtility.scrollPosition, rect2);
            }
            StatsReportUtility.listHeight = num + 100f;
            Widgets.EndScrollView();
            Rect rect4 = rect3.ContractedBy(10f);

            GUI.BeginGroup(rect4);
            StatDrawEntry statDrawEntry;

            if ((statDrawEntry = StatsReportUtility.selectedEntry) == null)
            {
                statDrawEntry = (StatsReportUtility.mousedOverEntry ?? StatsReportUtility.cachedDrawEntries.FirstOrDefault <StatDrawEntry>());
            }
            StatDrawEntry statDrawEntry2 = statDrawEntry;

            if (statDrawEntry2 != null)
            {
                StatRequest optionalReq;
                if (statDrawEntry2.hasOptionalReq)
                {
                    optionalReq = statDrawEntry2.optionalReq;
                }
                else if (optionalThing != null)
                {
                    optionalReq = StatRequest.For(optionalThing);
                }
                else
                {
                    optionalReq = StatRequest.ForEmpty();
                }
                string explanationText = statDrawEntry2.GetExplanationText(optionalReq);
                Rect   rect5           = rect4.AtZero();
                Widgets.Label(rect5, explanationText);
            }
            GUI.EndGroup();
        }