public override void DoWindowContents(Rect inRect)
        {
            float num  = 0f;
            Rect  rect = new Rect(0f, 0f, 150f, 35f);

            num = (float)(num + 150.0);
            if (Widgets.ButtonText(rect, "SelectOutfit".Translate(), true, false, true))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (Outfit allOutfit in Current.Game.outfitDatabase.AllOutfits)
                {
                    Outfit localOut = allOutfit;
                    list.Add(new FloatMenuOption(localOut.label, delegate
                    {
                        this.SelectedOutfit = localOut;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            num = (float)(num + 10.0);
            Rect rect2 = new Rect(num, 0f, 150f, 35f);

            num = (float)(num + 150.0);
            if (Widgets.ButtonText(rect2, "NewOutfit".Translate(), true, false, true))
            {
                this.SelectedOutfit = Current.Game.outfitDatabase.MakeNewOutfit();
            }
            num = (float)(num + 10.0);
            Rect rect3 = new Rect(num, 0f, 150f, 35f);

            num = (float)(num + 150.0);
            if (Widgets.ButtonText(rect3, "DeleteOutfit".Translate(), true, false, true))
            {
                List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                foreach (Outfit allOutfit2 in Current.Game.outfitDatabase.AllOutfits)
                {
                    Outfit localOut2 = allOutfit2;
                    list2.Add(new FloatMenuOption(localOut2.label, delegate
                    {
                        AcceptanceReport acceptanceReport = Current.Game.outfitDatabase.TryDelete(localOut2);
                        if (!acceptanceReport.Accepted)
                        {
                            Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput);
                        }
                        else if (localOut2 == this.SelectedOutfit)
                        {
                            this.SelectedOutfit = null;
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            float   width        = inRect.width;
            double  num2         = inRect.height - 40.0;
            Vector2 closeButSize = base.CloseButSize;
            Rect    rect4        = new Rect(0f, 40f, width, (float)(num2 - closeButSize.y)).ContractedBy(10f);

            if (this.SelectedOutfit == null)
            {
                GUI.color   = Color.grey;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect4, "NoOutfitSelected".Translate());
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
            }
            else
            {
                GUI.BeginGroup(rect4);
                Rect rect5 = new Rect(0f, 0f, 200f, 30f);
                Dialog_ManageOutfits.DoNameInputRect(rect5, ref this.SelectedOutfit.label);
                Rect        rect6        = new Rect(0f, 40f, 300f, (float)(rect4.height - 45.0 - 10.0));
                Rect        rect7        = rect6;
                ref Vector2 reference    = ref this.scrollPosition;
                ThingFilter filter       = this.SelectedOutfit.filter;
                ThingFilter parentFilter = Dialog_ManageOutfits.apparelGlobalFilter;
                int         openMask     = 16;
                IEnumerable <SpecialThingFilterDef> forceHiddenFilters = this.HiddenSpecialThingFilters();
                ThingFilterUI.DoThingFilterConfigWindow(rect7, ref reference, filter, parentFilter, openMask, (IEnumerable <ThingDef>)null, forceHiddenFilters, (List <ThingDef>)null);
                GUI.EndGroup();
            }
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.outfits == null)
            {
                Log.ErrorOnce(pawn + " tried to run JobGiver_OptimizeApparel without an OutfitTracker", 5643897, false);
                return(null);
            }
            if (pawn.Faction != Faction.OfPlayer)
            {
                Log.ErrorOnce("Non-colonist " + pawn + " tried to optimize apparel.", 764323, false);
                return(null);
            }
            if (!DebugViewSettings.debugApparelOptimize)
            {
                if (Find.TickManager.TicksGame < pawn.mindState.nextApparelOptimizeTick)
                {
                    return(null);
                }
            }
            else
            {
                JobGiver_OptimizeApparel.debugSb = new StringBuilder();
                JobGiver_OptimizeApparel.debugSb.AppendLine(string.Concat(new object[]
                {
                    "Scanning for ",
                    pawn,
                    " at ",
                    pawn.Position
                }));
            }
            Outfit         currentOutfit = pawn.outfits.CurrentOutfit;
            List <Apparel> wornApparel   = pawn.apparel.WornApparel;

            for (int i = wornApparel.Count - 1; i >= 0; i--)
            {
                if (!currentOutfit.filter.Allows(wornApparel[i]) && pawn.outfits.forcedHandler.AllowedToAutomaticallyDrop(wornApparel[i]))
                {
                    return(new Job(JobDefOf.RemoveApparel, wornApparel[i])
                    {
                        haulDroppedApparel = true
                    });
                }
            }
            Thing        thing = null;
            float        num   = 0f;
            List <Thing> list  = pawn.Map.listerThings.ThingsInGroup(ThingRequestGroup.Apparel);

            if (list.Count == 0)
            {
                this.SetNextOptimizeTick(pawn);
                return(null);
            }
            JobGiver_OptimizeApparel.neededWarmth = PawnApparelGenerator.CalculateNeededWarmth(pawn, pawn.Map.Tile, GenLocalDate.Twelfth(pawn));
            for (int j = 0; j < list.Count; j++)
            {
                Apparel apparel = (Apparel)list[j];
                if (currentOutfit.filter.Allows(apparel))
                {
                    if (apparel.IsInAnyStorage())
                    {
                        if (!apparel.IsForbidden(pawn))
                        {
                            if (!apparel.IsBurning())
                            {
                                float num2 = JobGiver_OptimizeApparel.ApparelScoreGain(pawn, apparel);
                                if (DebugViewSettings.debugApparelOptimize)
                                {
                                    JobGiver_OptimizeApparel.debugSb.AppendLine(apparel.LabelCap + ": " + num2.ToString("F2"));
                                }
                                if (num2 >= 0.05f && num2 >= num)
                                {
                                    if (ApparelUtility.HasPartsToWear(pawn, apparel.def))
                                    {
                                        if (pawn.CanReserveAndReach(apparel, PathEndMode.OnCell, pawn.NormalMaxDanger(), 1, -1, null, false))
                                        {
                                            thing = apparel;
                                            num   = num2;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (DebugViewSettings.debugApparelOptimize)
            {
                JobGiver_OptimizeApparel.debugSb.AppendLine("BEST: " + thing);
                Log.Message(JobGiver_OptimizeApparel.debugSb.ToString(), false);
                JobGiver_OptimizeApparel.debugSb = null;
            }
            if (thing == null)
            {
                this.SetNextOptimizeTick(pawn);
                return(null);
            }
            return(new Job(JobDefOf.Wear, thing));
        }