static void Postfix(Thing __instance)
        {
            if (!OutfittedMod.showApparelScores)
            {
                return;
            }

            if (Find.CameraDriver.CurrentZoom != CameraZoomRange.Closest)
            {
                return;
            }

            var pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (pawn == null || !pawn.IsColonistPlayerControlled)
            {
                return;
            }

            var apparel = __instance as Apparel;

            if (apparel == null)
            {
                return;
            }

            var outfit = pawn.outfits.CurrentOutfit as ExtendedOutfit;

            if (outfit == null)
            {
                return;
            }

            if (!outfit.filter.Allows(apparel))
            {
                return;
            }

            var scores = CachedScoresForPawn(pawn);

            float score = JobGiver_OptimizeApparel.ApparelScoreGain_NewTmp(pawn, apparel, scores);

            if (Math.Abs(score) > 0.01f)
            {
                var pos = GenMapUI.LabelDrawPosFor(apparel, 0f);
                GenMapUI.DrawThingLabel(pos, score.ToString("F1"), BeautyDrawer.BeautyColor(score, 3f));
            }
        }
Пример #2
0
 public void MapInterfaceOnGUI_BeforeMainTabs()
 {
     if (Find.CurrentMap == null)
     {
         return;
     }
     if (!WorldRendererUtility.WorldRenderedNow)
     {
         ScreenshotModeHandler screenshotMode = Find.UIRoot.screenshotMode;
         thingOverlays.ThingOverlaysOnGUI();
         MapComponentUtility.MapComponentOnGUI(Find.CurrentMap);
         BeautyDrawer.BeautyDrawerOnGUI();
         if (!screenshotMode.FiltersCurrentEvent)
         {
             colonistBar.ColonistBarOnGUI();
         }
         selector.dragBox.DragBoxOnGUI();
         designatorManager.DesignationManagerOnGUI();
         targeter.TargeterOnGUI();
         Find.CurrentMap.tooltipGiverList.DispenseAllThingTooltips();
         if (DebugViewSettings.drawFoodSearchFromMouse)
         {
             FoodUtility.DebugFoodSearchFromMouse_OnGUI();
         }
         if (DebugViewSettings.drawAttackTargetScores)
         {
             AttackTargetFinder.DebugDrawAttackTargetScores_OnGUI();
         }
         if (!screenshotMode.FiltersCurrentEvent)
         {
             mouseoverReadout.MouseoverReadoutOnGUI();
             globalControls.GlobalControlsOnGUI();
             resourceReadout.ResourceReadoutOnGUI();
         }
     }
     else
     {
         targeter.StopTargeting();
     }
 }
        private static void Postfix(Thing __instance)
        {
            if (!OutfitManagerMod.ShowApparelScores)
            {
                return;
            }
            if (Find.CameraDriver.CurrentZoom != CameraZoomRange.Closest)
            {
                return;
            }
            if (!(Find.Selector.SingleSelectedThing is Pawn pawn) || !pawn.IsColonistPlayerControlled)
            {
                return;
            }
            if (!(__instance is Apparel apparel))
            {
                return;
            }
            if (!(pawn.outfits.CurrentOutfit is ExtendedOutfit outfit))
            {
                return;
            }
            if (!outfit.filter.Allows(apparel))
            {
                return;
            }
            var wornApparelScores = pawn.apparel.WornApparel
                                    .Select(wornApparel => OutfitManagerMod.ApparelScoreRaw(pawn, wornApparel)).ToList();
            var score = JobGiver_OptimizeApparel.ApparelScoreGain_NewTmp(pawn, apparel, wornApparelScores);

            if (!(Math.Abs(score) > 0.01f))
            {
                return;
            }
            var pos = GenMapUI.LabelDrawPosFor(apparel, 0f);

            GenMapUI.DrawThingLabel(pos, score.ToString("F1", CultureInfo.InvariantCulture),
                                    BeautyDrawer.BeautyColor(score, 3f));
        }
Пример #4
0
 public void MapInterfaceOnGUI_BeforeMainTabs()
 {
     if (Find.CurrentMap != null)
     {
         if (!WorldRendererUtility.WorldRenderedNow)
         {
             ScreenshotModeHandler screenshotMode = Find.UIRoot.screenshotMode;
             Profiler.BeginSample("ThingOverlaysOnGUI()");
             this.thingOverlays.ThingOverlaysOnGUI();
             Profiler.EndSample();
             Profiler.BeginSample("MapComponentOnGUI()");
             MapComponentUtility.MapComponentOnGUI(Find.CurrentMap);
             Profiler.EndSample();
             Profiler.BeginSample("BeautyDrawerOnGUI()");
             BeautyDrawer.BeautyDrawerOnGUI();
             Profiler.EndSample();
             if (!screenshotMode.FiltersCurrentEvent)
             {
                 Profiler.BeginSample("ColonistBarOnGUI()");
                 this.colonistBar.ColonistBarOnGUI();
                 Profiler.EndSample();
             }
             Profiler.BeginSample("DragBoxOnGUI()");
             this.selector.dragBox.DragBoxOnGUI();
             Profiler.EndSample();
             Profiler.BeginSample("DesignationManagerOnGUI()");
             this.designatorManager.DesignationManagerOnGUI();
             Profiler.EndSample();
             Profiler.BeginSample("TargeterOnGUI()");
             this.targeter.TargeterOnGUI();
             Profiler.EndSample();
             Profiler.BeginSample("DispenseAllThingTooltips()");
             Find.CurrentMap.tooltipGiverList.DispenseAllThingTooltips();
             Profiler.EndSample();
             if (DebugViewSettings.drawFoodSearchFromMouse)
             {
                 Profiler.BeginSample("FoodUtility.DebugFoodSearchFromMouse_OnGUI()");
                 FoodUtility.DebugFoodSearchFromMouse_OnGUI();
                 Profiler.EndSample();
             }
             if (DebugViewSettings.drawAttackTargetScores)
             {
                 Profiler.BeginSample("AttackTargetFinder.DebugDrawAttackTargetScores_OnGUI()");
                 AttackTargetFinder.DebugDrawAttackTargetScores_OnGUI();
                 Profiler.EndSample();
             }
             if (!screenshotMode.FiltersCurrentEvent)
             {
                 Profiler.BeginSample("GlobalControlsOnGUI()");
                 this.globalControls.GlobalControlsOnGUI();
                 Profiler.EndSample();
                 Profiler.BeginSample("ResourceReadoutOnGUI()");
                 this.resourceReadout.ResourceReadoutOnGUI();
                 Profiler.EndSample();
             }
         }
         else
         {
             this.targeter.StopTargeting();
         }
     }
 }