private static IEnumerable <StatDrawEntry> StatsToDraw(Def def, ThingDef stuff)
        {
            _003CStatsToDraw_003Ec__Iterator0 _003CStatsToDraw_003Ec__Iterator = (_003CStatsToDraw_003Ec__Iterator0) /*Error near IL_0038: stateMachine*/;

            yield return(StatsReportUtility.DescriptionEntry(def));

            /*Error: Unable to find new state assignment for yield return*/;
        }
        private static IEnumerable <StatDrawEntry> StatsToDraw(WorldObject worldObject)
        {
            yield return(StatsReportUtility.DescriptionEntry(worldObject));

            foreach (StatDrawEntry stat in worldObject.SpecialDisplayStats)
            {
                yield return(stat);
            }
        }
 private static void FinalizeCachedDrawEntries(IEnumerable <StatDrawEntry> original)
 {
     StatsReportUtility.cachedDrawEntries = (from sd in original
                                             orderby sd.category.displayOrder, sd.DisplayPriorityWithinCategory descending, sd.LabelCap
                                             select sd).ToList();
     if (StatsReportUtility.cachedDrawEntries.Count > 0)
     {
         StatsReportUtility.SelectEntry(StatsReportUtility.cachedDrawEntries[0], false);
     }
 }
        private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject)
        {
            Rect outRect = new Rect(rect);

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

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

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

            foreach (StatDrawEntry ent in StatsReportUtility.cachedDrawEntries)
            {
                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);
                });
            }
            StatsReportUtility.listHeight = num + 100f;
            Widgets.EndScrollView();
            Rect rect3 = rect2.ContractedBy(10f);

            GUI.BeginGroup(rect3);
            if (StatsReportUtility.selectedEntry != null)
            {
                StatRequest optionalReq;
                if (StatsReportUtility.selectedEntry.hasOptionalReq)
                {
                    optionalReq = StatsReportUtility.selectedEntry.optionalReq;
                }
                else if (optionalThing != null)
                {
                    optionalReq = StatRequest.For(optionalThing);
                }
                else
                {
                    optionalReq = StatRequest.ForEmpty();
                }
                string explanationText = StatsReportUtility.selectedEntry.GetExplanationText(optionalReq);
                Rect   rect4           = rect3.AtZero();
                Widgets.Label(rect4, explanationText);
            }
            GUI.EndGroup();
        }
 public static void DrawStatsReport(Rect rect, Def def, ThingDef stuff)
 {
     if (StatsReportUtility.cachedDrawEntries.NullOrEmpty <StatDrawEntry>())
     {
         StatsReportUtility.cachedDrawEntries.AddRange(def.SpecialDisplayStats());
         StatsReportUtility.cachedDrawEntries.AddRange(from r in StatsReportUtility.StatsToDraw(def, stuff)
                                                       where r.ShouldDisplay
                                                       select r);
         StatsReportUtility.FinalizeCachedDrawEntries(StatsReportUtility.cachedDrawEntries);
     }
     StatsReportUtility.DrawStatsWorker(rect, null, null);
 }
 public static void DrawStatsReport(Rect rect, WorldObject worldObject)
 {
     if (StatsReportUtility.cachedDrawEntries.NullOrEmpty <StatDrawEntry>())
     {
         StatsReportUtility.cachedDrawEntries.AddRange(worldObject.def.SpecialDisplayStats());
         StatsReportUtility.cachedDrawEntries.AddRange(from r in StatsReportUtility.StatsToDraw(worldObject)
                                                       where r.ShouldDisplay
                                                       select r);
         StatsReportUtility.cachedDrawEntries.RemoveAll((StatDrawEntry de) => de.stat != null && !de.stat.showNonAbstract);
         StatsReportUtility.FinalizeCachedDrawEntries(StatsReportUtility.cachedDrawEntries);
     }
     StatsReportUtility.DrawStatsWorker(rect, null, worldObject);
 }
 public static void DrawStatsReport(Rect rect, Thing thing)
 {
     if (StatsReportUtility.cachedDrawEntries.NullOrEmpty <StatDrawEntry>())
     {
         StatsReportUtility.cachedDrawEntries.AddRange(thing.def.SpecialDisplayStats(StatRequest.For(thing)));
         StatsReportUtility.cachedDrawEntries.AddRange(from r in StatsReportUtility.StatsToDraw(thing)
                                                       where r.ShouldDisplay
                                                       select r);
         StatsReportUtility.cachedDrawEntries.RemoveAll((StatDrawEntry de) => de.stat != null && !de.stat.showNonAbstract);
         StatsReportUtility.FinalizeCachedDrawEntries(StatsReportUtility.cachedDrawEntries);
     }
     StatsReportUtility.DrawStatsWorker(rect, thing, null);
 }
 public static void DrawStatsReport(Rect rect, Def def, ThingDef stuff)
 {
     if (StatsReportUtility.cachedDrawEntries.NullOrEmpty <StatDrawEntry>())
     {
         BuildableDef buildableDef = def as BuildableDef;
         StatRequest  req          = (buildableDef == null) ? StatRequest.ForEmpty() : StatRequest.For(buildableDef, stuff, QualityCategory.Normal);
         StatsReportUtility.cachedDrawEntries.AddRange(def.SpecialDisplayStats(req));
         StatsReportUtility.cachedDrawEntries.AddRange(from r in StatsReportUtility.StatsToDraw(def, stuff)
                                                       where r.ShouldDisplay
                                                       select r);
         StatsReportUtility.FinalizeCachedDrawEntries(StatsReportUtility.cachedDrawEntries);
     }
     StatsReportUtility.DrawStatsWorker(rect, null, null);
 }
        private static IEnumerable <StatDrawEntry> StatsToDraw(Def def, ThingDef stuff)
        {
            yield return(StatsReportUtility.DescriptionEntry(def));

            BuildableDef eDef = def as BuildableDef;

            if (eDef != null)
            {
                foreach (StatDef stat in from st in DefDatabase <StatDef> .AllDefs
                         where st.Worker.ShouldShowFor(eDef)
                         select st)
                {
                    yield return(new StatDrawEntry(stat.category, stat, eDef.GetStatValueAbstract(stat, stuff), StatRequest.For(eDef, stuff, QualityCategory.Normal), ToStringNumberSense.Undefined));
                }
            }
        }
            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 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();
        }
        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 IEnumerable <StatDrawEntry> StatsToDraw(WorldObject worldObject)
        {
            yield return(StatsReportUtility.DescriptionEntry(worldObject));

            /*Error: Unable to find new state assignment for yield return*/;
        }