コード例 #1
0
 private void DrawSensitivityStat(LocalTargetInfo target)
 {
     if (target.Pawn != null)
     {
         Pawn    pawn      = target.Pawn;
         float   statValue = pawn.GetStatValue(StatDefOf.PsychicSensitivity);
         Vector3 drawPos   = pawn.DrawPos;
         drawPos.z += 1f;
         GenMapUI.DrawText(new Vector2(drawPos.x, drawPos.z), (string)(StatDefOf.PsychicSensitivity.LabelCap + ": ") + statValue, (statValue > float.Epsilon) ? Color.white : Color.red);
     }
 }
コード例 #2
0
        private void DoPawnRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            bool flag = this.draggedItem != null && rect2.Contains(Event.current.mousePosition) && this.CurrentWearerOf(this.draggedItem) != p;

            if ((Mouse.IsOver(rect2) && this.draggedItem == null) || flag)
            {
                Widgets.DrawHighlight(rect2);
            }
            if (flag && this.droppedDraggedItem)
            {
                this.TryEquipDraggedItem(p);
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect3, p, 1f);
            Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f);

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, false, false);
            float xMax = bgRect.xMax;

            if (p.equipment != null)
            {
                List <ThingWithComps> allEquipmentListForReading = p.equipment.AllEquipmentListForReading;
                for (int i = 0; i < allEquipmentListForReading.Count; i++)
                {
                    this.DoEquippedGear(allEquipmentListForReading[i], p, ref xMax);
                }
            }
            if (p.apparel != null)
            {
                WITab_Caravan_Gear.tmpApparel.Clear();
                WITab_Caravan_Gear.tmpApparel.AddRange(p.apparel.WornApparel);
                WITab_Caravan_Gear.tmpApparel.SortBy((Apparel x) => x.def.apparel.LastLayer.drawOrder, (Apparel x) => - x.def.apparel.HumanBodyCoverage);
                for (int j = 0; j < WITab_Caravan_Gear.tmpApparel.Count; j++)
                {
                    this.DoEquippedGear(WITab_Caravan_Gear.tmpApparel[j], p, ref xMax);
                }
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
コード例 #3
0
        private static void DoRow(Rect rect, Pawn pawn, Caravan caravan, ref Pawn specificNeedsTabForPawn, bool doNeeds)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, pawn, caravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, pawn);
            rect2.width -= 24f;
            if (!pawn.Dead)
            {
                CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn);
                rect2.width -= 24f;
            }
            Widgets.DrawHighlightIfMouseover(rect2);
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect3, pawn);
            Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f);

            GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            if (doNeeds)
            {
                GetNeedsToDisplay(pawn, tmpNeeds);
                float xMax = bgRect.xMax;
                for (int i = 0; i < tmpNeeds.Count; i++)
                {
                    Need      need = tmpNeeds[i];
                    int       maxThresholdMarkers = 0;
                    bool      doTooltip           = true;
                    Rect      rect4 = new Rect(xMax, 0f, 100f, 50f);
                    Need_Mood mood  = need as Need_Mood;
                    if (mood != null)
                    {
                        maxThresholdMarkers = 1;
                        doTooltip           = false;
                        if (Mouse.IsOver(rect4))
                        {
                            TooltipHandler.TipRegion(rect4, new TipSignal(() => CustomMoodNeedTooltip(mood), rect4.GetHashCode()));
                        }
                    }
                    need.DrawOnGUI(rect4, maxThresholdMarkers, 10f, drawArrows: false, doTooltip);
                    xMax = rect4.xMax;
                }
            }
            if (pawn.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
コード例 #4
0
        public void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering)
        {
            float alpha = ColonistBar.GetEntryRectAlpha(rect);

            ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color2 = GUI.color = new Color(1f, 1f, 1f, alpha);

            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                GUI.DrawTexture(position, MoodBGTex);
            }
            if (highlight)
            {
                int thickness = (!(rect.width <= 22f)) ? 3 : 2;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color2;
            }
            Rect rect2 = rect.ContractedBy(-2f * ColonistBar.Scale);

            if (((!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse)) && !WorldRendererUtility.WorldRenderedNow)
            {
                DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, PawnTextureSize, PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, DeadColonistTex);
            }
            float   num2   = 4f * ColonistBar.Scale;
            Vector2 center = rect.center;
            Vector2 pos    = new Vector2(center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + ColonistBar.SpaceBetweenColonistsHorizontal - 2f, pawnLabelsCache);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
        }
コード例 #5
0
        static bool Prefix(PawnUIOverlay __instance)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            if (pawn.GetExtendedPawnData() is ExtendedPawnData data && data.mount != null)
            {
                Vector2 pos = GenMapUI.LabelDrawPosFor(pawn, -(data.drawOffset + 0.6f));
                GenMapUI.DrawPawnLabel(pawn, pos, 1f, 9999f, null, GameFont.Tiny, true, true);
                return(false);
            }
            return(true);
        }
コード例 #6
0
        public static bool Prefix(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering,
                                  Dictionary <string, string> ___pawnLabelsCache, Vector2 ___PawnTextureSize,
                                  Texture2D ___MoodBGTex, Vector2[] ___bracketLocs)
        {
            if (colonist.Dead && colonist.HasStack())
            {
                float alpha = Find.ColonistBar.GetEntryRectAlpha(rect);
                ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
                if (reordering)
                {
                    alpha *= 0.5f;
                }
                Color color2 = GUI.color = new Color(1f, 1f, 1f, alpha);
                GUI.DrawTexture(rect, ColonistBar.BGTex);
                if (colonist.needs != null && colonist.needs.mood != null)
                {
                    Rect  position = rect.ContractedBy(2f);
                    float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                    position.yMin   = position.yMax - num;
                    position.height = num;
                    GUI.DrawTexture(position, ___MoodBGTex);
                }
                if (highlight)
                {
                    int thickness = (rect.width <= 22f) ? 2 : 3;
                    GUI.color = Color.white;
                    Widgets.DrawBox(rect, thickness);
                    GUI.color = color2;
                }
                Rect rect2 = rect.ContractedBy(-2f * Find.ColonistBar.Scale);
                if ((colonist.Dead ? Find.Selector.SelectedObjects.Contains(colonist.Corpse) : Find.Selector.SelectedObjects.Contains(colonist)) && !WorldRendererUtility.WorldRenderedNow)
                {
                    DrawSelectionOverlayOnGUI(colonist, rect2, ___bracketLocs);
                }

                GUI.DrawTexture(GetPawnTextureRect(rect.position, ___PawnTextureSize), PortraitsCache.Get(colonist, ___PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
                GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);

                float   num3 = 20f * Find.ColonistBar.Scale;
                Vector2 pos2 = new Vector2(rect.x + 1f, rect.yMax - num3 - 1f);
                DrawIcon(Icon_StackDead, ref pos2, "ActivityIconMedicalRest".Translate());
                GUI.color = color2;

                float   num2 = 4f * Find.ColonistBar.Scale;
                Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);
                GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + Find.ColonistBar.SpaceBetweenColonistsHorizontal - 2f, ___pawnLabelsCache);
                Text.Font = GameFont.Small;
                GUI.color = Color.white;
                return(false);
            }
            return(true);
        }
コード例 #7
0
        public void DrawPawnGUIOverlay()
        {
            if (!actor.Spawned || actor.Map.fogGrid.IsFogged(actor.Position))
            {
                return;
            }

            var pawn = Converter.ActorToPawn(actor);

            GenMapUI.DrawPawnLabel(pawn, GenMapUI.LabelDrawPosFor(pawn, -0.6f), 1f, 9999f, null, GameFont.Tiny, true, true);

            actor.Map.overlayDrawer.DrawOverlay(actor, OverlayTypes.QuestionMark);
        }
コード例 #8
0
        public void OnGUI()
        {
            if (toDrawLabels != null)
            {
                var list = toDrawLabels;

                foreach (Thing t in list)
                {
                    int pri = MainMod.Data.GetPriority(t);

                    GenMapUI.DrawThingLabel(t, pri.ToString(), pri.GetPriorityColor());
                }
            }
        }
コード例 #9
0
        public override void DrawGUIOverlay()
        {
            if (Find.CameraDriver.CurrentZoom != CameraZoomRange.Closest)
            {
                return;
            }

            if (!IsActive)
            {
                return;
            }

            GenMapUI.DrawThingLabel(GenMapUI.LabelDrawPosFor(parent, -0.66f), InfusedLabelAbbr, InfusedLabelColor);
        }
コード例 #10
0
        public override void DrawGUIOverlay()
        {
            base.DrawGUIOverlay();
            if (this.DrawStatus && Find.CameraDriver.CurrentZoom < CameraZoomRange.Middle)
            {
                string label  = "";
                string label2 = "";
                // only show overlay status text if has power:
                if (this.Active)
                {
                    if (currentBillReport != null) // the assembler is actively working
                    {                              // set the status text to the bill's label:
                        label = currentBillReport.bill.LabelCap;
                    }
                    else // the assembler is NOT working
                    {
                        // show why it is not working:
                        if (this.BillStack.AnyShouldDoNow)   // it DOES have bills
                        {
                            label = "SearchingForIngredients".Translate();
                        }
                        else     // it DOESN'T have bills:
                        {
                            label = "AssemblerNoBills".Translate();
                        }
                    }
                    // draw the label on the screen:
                }
                else if (compFlick?.SwitchIsOn == false)
                {
                    label = "SwitchedOff".Translate();
                }

                if (!AllowProduction_thingQueue)
                {
                    label2 = "PRF_OutputBufferWarning".Translate();
                }
                else if (thingQueue.Count > 1)
                {
                    label2 = "SAL3_Products".Translate(thingQueue.Count, max_thingQueue_Count);
                }
                Vector2 vectorpos = GenMapUI.LabelDrawPosFor(this, 0f);
                GenMapUI.DrawThingLabel(vectorpos, label, Color.white);
                vectorpos.y += Verse.Text.CalcSize(label).y;


                GenMapUI.DrawThingLabel(vectorpos, label2, Color.yellow);
            }
        }
コード例 #11
0
 public override void DrawGUIOverlay()
 {
     if (Props.drawAssignmentOverlay && (Props.drawUnownedAssignmentOverlay || assignedPawns.Any()) && Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest && PlayerCanSeeAssignments)
     {
         Color defaultThingLabelColor = GenMapUI.DefaultThingLabelColor;
         if (!assignedPawns.Any())
         {
             GenMapUI.DrawThingLabel(parent, "Unowned".Translate(), defaultThingLabelColor);
         }
         if (assignedPawns.Count == 1 && CanDrawOverlayForPawn(assignedPawns[0]))
         {
             GenMapUI.DrawThingLabel(parent, assignedPawns[0].LabelShort, defaultThingLabelColor);
         }
     }
 }
コード例 #12
0
 public override void DrawGUIOverlay()
 {
     if (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest && this.PlayerCanSeeOwners)
     {
         Color defaultThingLabelColor = GenMapUI.DefaultThingLabelColor;
         if (!this.owners.Any <Pawn>())
         {
             GenMapUI.DrawThingLabel(this, "Unowned".Translate(), defaultThingLabelColor);
         }
         else if (this.owners.Count == 1)
         {
             GenMapUI.DrawThingLabel(this, this.owners[0].NameStringShort, defaultThingLabelColor);
         }
     }
 }
コード例 #13
0
 public override void DrawGUIOverlay()
 {
     if (Props.drawAssignmentOverlay && (Props.drawUnownedAssignmentOverlay || assignedStation != null) && Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest && PlayerCanSeeAssignments)
     {
         Color defaultThingLabelColor = GenMapUI.DefaultThingLabelColor;
         if (assignedStation == null)
         {
             GenMapUI.DrawThingLabel(parent, "Unowned".Translate(), defaultThingLabelColor);
         }
         if (assignedStation != null && CanDrawOverlayForStation(assignedStation))
         {
             GenMapUI.DrawThingLabel(parent, assignedStation.LabelShort, defaultThingLabelColor);
         }
     }
 }
コード例 #14
0
        public override void DrawGUIOverlay()
        {
            base.DrawGUIOverlay();

            if (this.State != WorkingState.Ready && Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest)
            {
                var p = CarryPosition();
                if (!this.ToUnderground || this.WorkLeft > 0.7f)
                {
                    Vector2 result = Find.Camera.WorldToScreenPoint(p + new Vector3(0, 0, -0.4f)) / Prefs.UIScale;
                    result.y = (float)UI.screenHeight - result.y;
                    GenMapUI.DrawThingLabel(result, this.CarryingThing().stackCount.ToStringCached(), GenMapUI.DefaultThingLabelColor);
                }
            }
        }
コード例 #15
0
        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));
            }
        }
コード例 #16
0
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton((float)(rect2.width - 24.0), (float)((rect.height - 24.0) / 2.0), p);
            rect2.width -= 24f;
            CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, p, ref this.specificHealthTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (float)((rect.height - 27.0) / 2.0), 27f, 27f);

            Widgets.ThingIcon(rect3, p, 1f);
            Rect bgRect = new Rect((float)(rect3.xMax + 4.0), 16f, 100f, 18f);

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, false, false);
            if (!this.compactMode)
            {
                float num = bgRect.xMax;
                if (p.RaceProps.IsFlesh)
                {
                    Rect rect4 = new Rect(num, 0f, 100f, 50f);
                    this.DoPain(rect4, p);
                }
                List <PawnCapacityDef> list = this.CapacitiesToDisplay;
                for (int i = 0; i < list.Count; i++)
                {
                    num = (float)(num + 100.0);
                    Rect rect5 = new Rect(num, 0f, 100f, 50f);
                    if ((!p.RaceProps.Humanlike || list[i].showOnHumanlikes) && (!p.RaceProps.Animal || list[i].showOnAnimals) && (!p.RaceProps.IsMechanoid || list[i].showOnMechanoids) && PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i]))
                    {
                        this.DoCapacity(rect5, p, list[i]);
                    }
                }
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, (float)(rect.height / 2.0), rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
コード例 #17
0
        public static void DebugDrawAttackTargetScores_OnGUI()
        {
            IAttackTargetSearcher attackTargetSearcher = Find.Selector.SingleSelectedThing as IAttackTargetSearcher;

            if (attackTargetSearcher == null)
            {
                return;
            }
            if (attackTargetSearcher.Thing.Map != Find.CurrentMap)
            {
                return;
            }
            Verb currentEffectiveVerb = attackTargetSearcher.CurrentEffectiveVerb;

            if (currentEffectiveVerb == null)
            {
                return;
            }
            List <Thing> list = attackTargetSearcher.Thing.Map.listerThings.ThingsInGroup(ThingRequestGroup.AttackTarget);

            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Tiny;
            for (int i = 0; i < list.Count; i++)
            {
                Thing thing = list[i];
                if (thing != attackTargetSearcher)
                {
                    string text;
                    Color  red;
                    if (!AttackTargetFinder.CanShootAtFromCurrentPosition((IAttackTarget)thing, attackTargetSearcher, currentEffectiveVerb))
                    {
                        text = "out of range";
                        red  = Color.red;
                    }
                    else
                    {
                        text = AttackTargetFinder.GetShootingTargetScore((IAttackTarget)thing, attackTargetSearcher, currentEffectiveVerb).ToString("F0");
                        red  = new Color(0.25f, 1f, 0.25f);
                    }
                    Vector2 screenPos = thing.DrawPos.MapToUIPosition();
                    GenMapUI.DrawThingLabel(screenPos, text, red);
                }
            }
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
        }
コード例 #18
0
        public override void DrawGUIOverlay()
        {
            float a     = 1f - (AgeSecs - TimeBeforeStartFadeout) / def.mote.fadeOutTime;
            Color color = new Color(textColor.r, textColor.g, textColor.b, a);

            GenMapUI.DrawText(new Vector2(exactPosition.x, exactPosition.z), text, color);

            /*
             * Vector3 position = new Vector3(exactPosition.x, 0f, exactPosition.z);
             * Vector2 vector = Find.Camera.WorldToScreenPoint(position) / Prefs.UIScale;
             * vector.y = UI.screenHeight - vector.y;
             * Text.Font = GameFont.Medium;
             * GUIText.color = textColor;
             * Text.Anchor = TextAnchor.UpperCenter;
             * float x = Text.CalcSize(text).x;
             * Widgets.Label(new Rect(vector.x - x / 2f, vector.y - 2f, x, 999f), text);
             * GUI.color = Color.white;
             * Text.Anchor = TextAnchor.UpperLeft;*/
        }
コード例 #19
0
 private static void DrawFertilityAroundMouse()
 {
     if (!PlaySettingsPatch.showFertilityOverlay)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     for (int i = 0; i < FertilityUtility.fertilityRelevantCells.Count; i++)
     {
         IntVec3 intVec = FertilityUtility.fertilityRelevantCells[i];
         float   num    = FertilityUtility.CellFertility(intVec, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(intVec);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
コード例 #20
0
        public void DrawColonist(Rect rect, Pawn colonist, Map pawnMap)
        {
            float entryRectAlpha = this.ColonistBar.GetEntryRectAlpha(rect);

            this.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref entryRectAlpha);
            bool  flag  = (!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse);
            Color color = new Color(1f, 1f, 1f, entryRectAlpha);

            GUI.color = color;
            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
            }
            Rect rect2 = rect.ContractedBy(-2f * this.ColonistBar.Scale);

            if (flag && !WorldRendererUtility.WorldRenderedNow)
            {
                this.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                this.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(this.GetPawnTextureRect(rect.x, rect.y), PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, entryRectAlpha * 0.8f);
            this.DrawIcons(rect, colonist);
            GUI.color = color;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num2 = 4f * this.ColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, entryRectAlpha, rect.width + this.ColonistBar.SpaceBetweenColonistsHorizontal - 2f, this.pawnLabelsCache, GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
        }
コード例 #21
0
        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));
        }
コード例 #22
0
        public void OnGUI()
        {
            Text.Font = GameFont.Tiny;
            var      map             = Find.CurrentMap;
            CellRect currentViewRect = Find.CameraDriver.CurrentViewRect;

            foreach (var roomWithLabelCell in RoomsWithLabelCells)
            {
                var cell = roomWithLabelCell.Cell;
                if (!currentViewRect.Contains(cell))
                {
                    continue;
                }

                var panelLength = 20f;
                var panelHeight = 20f;
                var panelSize   = new Vector2(panelLength, panelHeight);
                var drawTopLeft = GenMapUI.LabelDrawPosFor(cell);
                var labelRect   = new Rect(drawTopLeft.x, drawTopLeft.y, panelSize.x, panelSize.y);
                Widgets.Label(labelRect, roomWithLabelCell.Room.Temperature.ToStringTemperature("F0"));
            }
        }
コード例 #23
0
        static void Postfix(Thing thing)
        {
            if (!CompInfused.TryGetInfusedComp(thing, out CompInfused comp))
            {
                return;
            }

            Text.Font   = GameFont.Tiny;
            Text.Anchor = TextAnchor.UpperCenter;
            GUI.color   = comp.InfusedLabelColor;

            string text      = comp.InfusedLabelShort;
            float  x         = Text.CalcSize(text).x;
            var    screenPos = GenMapUI.LabelDrawPosFor(thing, -0.66f);
            var    rect      = new Rect(screenPos.x - x / 2f, screenPos.y - 3f, x, 999f);

            Widgets.Label(rect, text);

            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
        }
コード例 #24
0
 public override void DrawGUIOverlay()
 {
     if (this.CheatMod)
     {
         GenMapUI.DrawThingLabel(this, "Cheat Mode", Color.red);
     }
     else if (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest)
     {
         Color defaultThingLabelColor = GenMapUI.DefaultThingLabelColor;
         if (this.PodOwner == null)
         {
             GenMapUI.DrawThingLabel(this, "Unowned".Translate(), defaultThingLabelColor);
         }
         else if (this.JobState != PS_Conditioning_JobState.Waiting)
         {
             // Draw nothing because the progress bar will be there
         }
         else
         {
             GenMapUI.DrawThingLabel(this, this.PodOwner.LabelShort, defaultThingLabelColor);
         }
     }
 }
コード例 #25
0
 private static void DrawFertilityAroundMouse()
 {
     if (!Find.PlaySettings.showFertilityOverlay)
     {
         return;
     }
     // Prevent overlap with beauty display
     if (Find.PlaySettings.showBeauty)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     foreach (var cell in FertilityUtility.fertilityRelevantCells)
     {
         float num = FertilityUtility.CellFertility(cell, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(cell);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
コード例 #26
0
        internal static void _DrawPawnGUIOverlay(this PawnUIOverlay _this)
        {
            if (!_this.GetPawn().Spawned || _this.GetPawn().Map.fogGrid.IsFogged(_this.GetPawn().Position) || _this.GetPawn().health.hediffSet.HasHediff(HediffDefOfPsychology.Thief))
            {
                return;
            }
            if (!_this.GetPawn().RaceProps.Humanlike)
            {
                switch (Prefs.AnimalNameMode)
                {
                case AnimalNameDisplayMode.None:
                    return;

                case AnimalNameDisplayMode.TameNamed:
                    if (_this.GetPawn().Name == null || _this.GetPawn().Name.Numerical)
                    {
                        return;
                    }
                    break;

                case AnimalNameDisplayMode.TameAll:
                    if (_this.GetPawn().Name == null)
                    {
                        return;
                    }
                    break;
                }
            }
            Vector2 pos = GenMapUI.LabelDrawPosFor(_this.GetPawn(), -0.6f);

            GenMapUI.DrawPawnLabel(_this.GetPawn(), pos, 1f, 9999f, null, GameFont.Tiny, true, true);
            if (_this.GetPawn().CanTradeNow)
            {
                _this.GetPawn().Map.overlayDrawer.DrawOverlay(_this.GetPawn(), OverlayTypes.QuestionMark);
            }
        }
コード例 #27
0
        public static void DrawThingName(Thing thing)
        {
            if (CanDrawThingName(thing, out CompRenamable renamableComp))
            {
                // Do background
                Text.Font = GameFont.Tiny;
                var    screenPos      = GenMapUI.LabelDrawPosFor(thing, -0.4f);
                string text           = Text.CalcSize(renamableComp.Name).x <= MaxTextWidth ? renamableComp.Name : renamableComp.Name.Shorten().Truncate(MaxTextWidth);
                float  x              = Text.CalcSize(text).x;
                var    backgroundRect = new Rect(screenPos.x - x / 2 - 4, screenPos.y, x + 8, 12);
                GUI.DrawTexture(backgroundRect, TexUI.GrayTextBG);

                // Do label
                Text.Anchor = TextAnchor.UpperCenter;
                ChangeGUIColourPreLabelDraw(thing);
                var textRect = new Rect(screenPos.x - x / 2, screenPos.y - 3, x, 999);
                Widgets.Label(textRect, text);
                ChangeGUIColourPostLabelDraw();

                // Finish off
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            }
        }
コード例 #28
0
        public static bool Prefix(ColonistBarColonistDrawer __instance,
                                  ref Rect rect, ref Pawn colonist, ref Map pawnMap,
                                  ref bool highlight, ref bool reordering)
        {
            ColonistBar colonistBar    = Find.ColonistBar;
            float       entryRectAlpha = colonistBar.GetEntryRectAlpha(rect);

            entryRectAlpha = ApplyEntryInAnotherMapAlphaFactor(pawnMap, entryRectAlpha);

            if (reordering)
            {
                entryRectAlpha *= 0.5f;
            }

            Color color = new Color(1f, 1f, 1f, entryRectAlpha);

            GUI.color = color;

            GUI.DrawTexture(rect, ColonistBar.BGTex);

            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;

                Texture2D moodTexture = getMoodTexture(ref colonist);
                GUI.DrawTexture(position, moodTexture);
            }

            if (highlight)
            {
                int thickness = (rect.width > 22f) ? 3 : 2;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color;
            }

            Rect rect2 = rect.ContractedBy(-2f * colonistBar.Scale);

            bool isColonistSelected = colonist.Dead ?
                                      Find.Selector.SelectedObjects.Contains(colonist.Corpse) :
                                      Find.Selector.SelectedObjects.Contains(colonist);

            if (isColonistSelected && !WorldRendererUtility.WorldRenderedNow)
            {
                Main.drawSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist, rect2 });
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                Main.drawCaravanSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist.GetCaravan(), rect2 });
            }

            Rect pawnTexturePosition = __instance.GetPawnTextureRect(new Vector2(rect.x, rect.y));

            GUI.DrawTexture(pawnTexturePosition, PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize,
                                                                    ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, entryRectAlpha * 0.8f);
            Main.drawIconsMethod.Invoke(__instance, new object[] { rect, colonist });
            GUI.color = color;

            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, (Texture)Main.deadColonistTexField.GetValue(null));
            }

            float   num2 = 4f * colonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, entryRectAlpha,
                                   rect.width + colonistBar.SpaceBetweenColonistsHorizontal - 2f,
                                   (Dictionary <string, string>)Main.pawnLabelsCacheField.GetValue(__instance),
                                   GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            return(false);
        }
コード例 #29
0
        private static void DoRow(Rect rect, Thing thing, CompVehicle vehicle, ref Pawn specificNeedsTabForPawn, bool doNeeds)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();
            Pawn pawn  = thing as Pawn;

            //if (listingUsesAbandonSpecificCountButtons)
            //{
            //    if (thing.stackCount != 1)
            //    {
            //        CaravanPeopleAndItemsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan);
            //    }
            //    rect2.width -= 24f;
            //}
            //CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, thing, caravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, thing);
            rect2.width -= 24f;
            if (pawn != null && !pawn.Dead)
            {
                CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn);
                rect2.width -= 24f;
            }
            if (pawn == null)
            {
                Rect rect3 = rect2;
                rect3.xMin = rect3.xMax - 60f;
                CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect3);
                rect2.width -= 60f;
            }
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect4 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect4, thing, 1f);
            if (pawn != null)
            {
                Rect bgRect = new Rect(rect4.xMax + 4f, 16f, 100f, 18f);
                GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false);
                if (doNeeds)
                {
                    GetNeedsToDisplay(pawn, tmpNeeds);
                    float xMax = bgRect.xMax;
                    for (int i = 0; i < tmpNeeds.Count; i++)
                    {
                        Need need = tmpNeeds[i];
                        int  maxThresholdMarkers = 0;
                        bool doTooltip           = true;
                        Rect rect5 = new Rect(xMax, 0f, 100f, 50f);
#pragma warning disable IDE0019 // Use pattern matching
                        Need_Mood mood = need as Need_Mood;
#pragma warning restore IDE0019 // Use pattern matching
                        if (mood != null)
                        {
                            maxThresholdMarkers = 1;
                            doTooltip           = false;
                            //TooltipHandler.TipRegion(rect5, new TipSignal(() => CaravanPeopleAndItemsTabUtility.CustomMoodNeedTooltip(mood), rect5.GetHashCode()));
                        }
                        need.DrawOnGUI(rect5, maxThresholdMarkers, 10f, false, doTooltip);
                        xMax = rect5.xMax;
                    }
                }
                if (pawn.Downed)
                {
                    GUI.color = new Color(1f, 0f, 0f, 0.5f);
                    Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                    GUI.color = Color.white;
                }
            }
            else
            {
                Rect rect6 = new Rect(rect4.xMax + 4f, 0f, 300f, 30f);
                Text.Anchor   = TextAnchor.MiddleLeft;
                Text.WordWrap = false;
                Widgets.Label(rect6, thing.LabelCap);
                Text.Anchor   = TextAnchor.UpperLeft;
                Text.WordWrap = true;
            }
            GUI.EndGroup();
        }
コード例 #30
0
        public override void OnGUI()
        {
            if (Find.CurrentMap == null || WorldRendererUtility.WorldRenderedNow)
            {
                return;
            }
            if (Find.DesignatorManager == null)
            {
                return;
            }
            //Logger.Message(Find.DesignatorManager.SelectedDesignator.GetType().ToString());
            if (Find.DesignatorManager.SelectedDesignator is Designator_Priority_Cell)
            {
                PriorityDraw = PriorityDrawMode.Cell;
            }
            else if (Find.DesignatorManager.SelectedDesignator is Designator_Priority_Thing)
            {
                PriorityDraw = PriorityDrawMode.Thing;
            }
            else
            {
                PriorityDraw = ForcedDrawMode;
            }

            Map map = Find.CurrentMap;

            if (PriorityDraw != PriorityDrawMode.None)
            {
                AdjustPriorityMouseControl();

                CellRect rect = GetMapRect();
                if (rect.Area >= 10000)
                {
                    return;
                }
                foreach (IntVec3 intVec in rect)
                {
                    if (!intVec.InBounds(map))
                    {
                        continue;
                    }
                    if (PriorityDraw == PriorityDrawMode.Cell)
                    {
                        Vector3 v = GenMapUI.LabelDrawPosFor(intVec);
                        int     p = save.GetOrCreatePriorityMapData(map).GetPriorityAt(intVec);
                        if (p == 0)
                        {
                            continue;
                        }
                        DrawThingLabel(v, p.ToString(), GetPriorityDrawColor(true, p));
                    }
                    else if (PriorityDraw == PriorityDrawMode.Thing)
                    {
                        var th = intVec.GetThingList(map);
                        for (int j = 0; j < th.Count; j++)
                        {
                            var thing = th[j];
                            if (ThingShowCond(thing) && save.TryGetThingPriority(thing, out int pri))
                            {
                                DrawThingLabel(GenMapUI.LabelDrawPosFor(thing, 0f), pri.ToString(), GetPriorityDrawColor(false, pri));
                            }
                        }
                    }
                }
            }
        }