public override string GetExplanation()
        {
            StringBuilder sb      = new StringBuilder();
            StoryManager  manager = StoryManager.StoryHandler;

            foreach (Mission mission in manager.Missions)
            {
                if (mission.HasTimer && mission.LatestState == MOState.Active && mission.GetTimer < GenDate.TicksPerHour * manager.timerAlertMinHours)
                {
                    sb.AppendLine("    - " + mission.def.LabelCap + ": " + StoryUtils.GetTimerText(mission.GetTimer, MOState.Active));
                }
            }
            foreach (Objective objective in manager.GetObjectives)
            {
                if (objective.def.type != ObjectiveType.Wait && objective.HasTimer && objective.CurrentState == MOState.Active && objective.GetTimer < GenDate.TicksPerHour * manager.timerAlertMinHours)
                {
                    sb.AppendLine("    - " + objective.def.LabelCap + ": " + StoryUtils.GetTimerText(objective.GetTimer, MOState.Active));
                }
            }
            return("TimerAlertDesc_SMO".Translate(sb.ToString()));
        }
Ejemplo n.º 2
0
        public void DrawObjectiveMenu(Rect inRect)
        {
            StoryUtils.DrawMenuSectionColor(inRect, 1, new ColorInt(55, 55, 55), new ColorInt(135, 135, 135));
            //Widgets.DrawMenuSection(inRect);
            if (SelectedObjective == null)
            {
                SelectedObjective = SelectedMission.objectives.FirstOrDefault();
            }
            GUI.BeginGroup(inRect);
            float third = inRect.width / 3f;

            //Rects
            bool   missionTimer      = SelectedMission.HasTimer;
            string timerText         = "MissionTimer_SMO".Translate() + ": ";
            float  timerHeight       = Text.CalcSize(timerText).y + 20f;
            float  descriptionHeight = missionTimer ? inRect.height - timerHeight : inRect.height;
            Rect   DescriptionRect   = new Rect(0f, 0f, third, descriptionHeight);
            Rect   MissionExtrasRect = new Rect(DescriptionRect.x, DescriptionRect.yMax, third, timerHeight);
            Rect   InnerRect         = new Rect(DescriptionRect.xMax, 0f, third * 2f, inRect.height);
            Rect   ImageRect         = InnerRect.TopHalf().ContractedBy(5f);
            Rect   ObjectiveRect     = InnerRect.BottomHalf();

            //Description
            Widgets.DrawMenuSection(DescriptionRect.ContractedBy(5f));
            StringBuilder description = new StringBuilder();

            description.AppendLine(SelectedMission.def.description?.ToString() + "\n");
            description.AppendLine(SelectedObjective?.def.description?.ToString());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.LabelScrollable(DescriptionRect.ContractedBy(10f), description.ToString(), ref descriptionScrollPos);
            //Widgets.Label(DescriptionRect.ContractedBy(10f), description.ToString());
            Text.Anchor = 0;

            Rect timerRect = MissionExtrasRect.ContractedBy(5f);

            if (missionTimer)
            {
                Widgets.DrawMenuSection(timerRect);
                Rect timer = MissionExtrasRect.RightHalf();
                Widgets.Label(timer.ContractedBy(10f), timerText);
                Rect  BarRect = new Rect(timerRect.xMax - 96f, timerRect.ContractedBy(6f).y, 90f, timerRect.ContractedBy(6f).height);
                float pct     = (float)SelectedMission.GetTimer / (float)SelectedMission.def.timer.GetTotalTime;
                DrawProgressBar(BarRect, StoryUtils.GetTimerText(SelectedMission.GetTimer, SelectedMission.LatestState), pct, StoryMats.grey);
            }


            //
            if (SelectedObjective == null)
            {
                return;
            }

            //Image Slide
            Vector2 buttonSize       = new Vector2(45f, ImageRect.height);
            Rect    ImageButtonLeft  = new Rect(new Vector2(ImageRect.x, ImageRect.y), buttonSize).ContractedBy(5f);
            Rect    ImageButtonRight = new Rect(new Vector2(ImageRect.xMax - 45f, ImageRect.y), buttonSize).ContractedBy(5f);

            Widgets.DrawShadowAround(ImageRect);
            Widgets.DrawBoxSolid(ImageRect, new Color(0.14f, 0.14f, 0.14f));

            if (SelectedObjective != null)
            {
                if (cachedImages.TryGetValue(SelectedObjective.def, out List <Texture2D> list) && list[currentImage] != null)
                {
                    Widgets.DrawTextureFitted(ImageRect, list[currentImage], 1f);
                }
            }
            GUI.color = new Color(1f, 1f, 1f, 0.5f);
            if (Mouse.IsOver(ImageRect) && cachedImages.TryGetValue(SelectedObjective?.def, out List <Texture2D> texts))
            {
                string  imageCount     = (currentImage + 1) + "/" + texts.Count;
                Vector2 size           = Text.CalcSize(imageCount);
                Rect    imageCountRect = new Rect(new Vector2(0f, 0f), size);
                imageCountRect.center = new Vector2(ImageRect.center.x, ImageRect.yMax - (size.y * 0.5f));
                Widgets.Label(imageCountRect, imageCount);
                if (currentImage > 0)
                {
                    UI.RotateAroundPivot(180f, ImageButtonLeft.center);
                    Widgets.DrawTextureFitted(ImageButtonLeft, StoryMats.arrow, 1f);
                    UI.RotateAroundPivot(180f, ImageButtonLeft.center);
                    if (Widgets.ButtonInvisible(ImageButtonLeft, true))
                    {
                        SoundDefOf.TabClose.PlayOneShotOnCamera(null);
                        currentImage -= 1;
                    }
                }
                if (currentImage < texts.Count - 1)
                {
                    Widgets.DrawTextureFitted(ImageButtonRight, StoryMats.arrow, 1f);
                    if (Widgets.ButtonInvisible(ImageButtonRight, true))
                    {
                        SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
                        currentImage += 1;
                    }
                }
            }
            GUI.color = Color.white;

            //Objectives
            Widgets.DrawMenuSection(ObjectiveRect.ContractedBy(5f));
            Rect ObjectiveContracted = ObjectiveRect.ContractedBy(6f);

            GUI.BeginGroup(ObjectiveContracted);
            float tabHeight  = 60f;
            float viewHeight = SelectedMission.objectives.Where(o => o.Active).Count() * tabHeight;
            Rect  outRect    = new Rect(0f, 0f, ObjectiveContracted.width, ObjectiveContracted.height);
            Rect  viewRect   = new Rect(0f, 0f, ObjectiveContracted.width, viewHeight);

            Widgets.BeginScrollView(outRect, ref StoryManager.objectiveScrollPos, viewRect, false);
            float yPos = 0f;

            for (int i = 0; i < SelectedMission.objectives.Count; i++)
            {
                Objective objective = SelectedMission.objectives[i];
                if (objective.Active || DebugSettings.godMode)
                {
                    Rect Objective = new Rect(0f, yPos, ObjectiveContracted.width, tabHeight);
                    DrawObjectiveTab(Objective, objective, i);
                    yPos += tabHeight;
                }
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
            GUI.EndGroup();
        }
Ejemplo n.º 3
0
        private void DrawObjectiveTab(Rect TabRect, Objective objective, int num)
        {
            if (num % 2 == 0)
            {
                Widgets.DrawBoxSolid(TabRect, new ColorInt(50, 50, 50).ToColor);
            }
            //Setup
            ObjectiveDef Def = objective.def;

            TabRect = TabRect.ContractedBy(5f);
            GUI.BeginGroup(TabRect);
            //Label
            string  Label     = Def.LabelCap;
            Vector2 LabelSize = Text.CalcSize(Label);
            Rect    LabelRect = new Rect(new Vector2(0f, 0f), LabelSize);

            Widgets.Label(LabelRect, Label);

            //Target
            string  TargetLabel  = ResolveTargetLabel(Def);
            Vector2 TargetSize   = Text.CalcSize(TargetLabel);
            Rect    TargetRect   = new Rect(new Vector2(0f, TabRect.height - TargetSize.y), TargetSize);
            Rect    InfoCardRect = new Rect(TargetLabel.NullOrEmpty() ? -5f : TargetRect.xMax, TargetRect.y, TargetRect.height, TargetRect.height);

            if (!TargetLabel.NullOrEmpty())
            {
                bool MouseOver = Mouse.IsOver(TargetRect);
                GUI.color = MouseOver ? new Color(0.8f, 0.8f, 0.8f) : new Color(0.6f, 0.6f, 0.6f);
                Widgets.Label(TargetRect, TargetLabel);
                GUI.color = Color.white;
            }
            Rect InfoCardAreaRect = new Rect(TargetRect.x, TargetRect.y, TargetRect.width + InfoCardRect.width, TargetRect.height);

            TooltipHandler.TipRegion(InfoCardAreaRect, "InfoCard_SMO".Translate());
            if (Widgets.ButtonInvisible(TargetRect) || Widgets.ButtonImage(InfoCardRect, StoryMats.info2, GUI.color))
            {
                Find.WindowStack.Add(CurObjectiveInfo = new Dialog_ObjectiveInformation(objective));
            }
            UIHighlighter.HighlightOpportunity(InfoCardRect, "InfoCard");

            //ProgressBar
            Vector2 size       = new Vector2(90f, 20f);
            Rect    BarRect    = new Rect();
            Rect    BotBarRect = new Rect();

            ResolveBarInputs(objective, out float pct, out string label, out Texture2D material);
            if (material != null)
            {
                BarRect = new Rect(new Vector2(TabRect.xMax - (size.x + 5f), 0f), size);
                DrawProgressBar(BarRect, label, pct, material);
                if (objective.thingTracker?.ResolveButtonInput(BarRect) ?? false)
                {
                    TooltipHandler.TipRegion(BarRect, "BarInput_SMO".Translate());
                }
            }
            if (objective.def.timer.GetTotalTime > 0)
            {
                BotBarRect = new Rect(new Vector2(TabRect.xMax - (size.x + 5f), TabRect.height - (size.y + 5f)), size);
                float timer = objective.GetTimer;
                pct   = timer / objective.def.timer.GetTotalTime;
                label = StoryUtils.GetTimerText(objective.GetTimer, objective.CurrentState);
                if (objective.CurrentState == MOState.Finished)
                {
                    pct = 0f;
                }
                DrawProgressBar(BotBarRect, label, pct, StoryMats.grey);
            }

            //SkillRequirements
            Rect SkillRequirementRect = new Rect();

            if (objective.def.skillRequirements.Count > 0)
            {
                bool check = BarRect.width + BotBarRect.width > 0f;
                SkillRequirementRect = new Rect(TabRect.xMax - (10f + (check ? 180f : 90f)), 0f, 90f, TabRect.height);
                bool MouseOver = Mouse.IsOver(SkillRequirementRect);
                GUI.color   = MouseOver ? new Color(0.8f, 0.8f, 0.8f) : new Color(0.6f, 0.6f, 0.6f);
                Text.Anchor = TextAnchor.UpperCenter;
                Text.Font   = GameFont.Medium;
                int count = 0;
                if (cachedPawns.TryGetValue(objective.def, out List <Pawn> pawns))
                {
                    if (!pawns.NullOrEmpty())
                    {
                        count = pawns.Count;
                    }
                }
                Widgets.Label(SkillRequirementRect, count.ToString());
                Text.Font   = GameFont.Tiny;
                Text.Anchor = TextAnchor.LowerCenter;
                Widgets.Label(SkillRequirementRect, count != 1 ? "SkillReqPlural_SMO".Translate() : "SkillReq_SMO".Translate());
                Text.Font   = GameFont.Small;
                Text.Anchor = 0;
                GUI.color   = Color.white;

                StringBuilder sb = new StringBuilder();
                if (!pawns.NullOrEmpty())
                {
                    foreach (Pawn pawn in pawns)
                    {
                        sb.AppendLine("       - " + pawn.LabelCap);
                    }
                }
                StringBuilder sb2 = new StringBuilder();
                foreach (SkillRequirement sr in objective.def.skillRequirements)
                {
                    sb2.AppendLine("       - " + sr.Summary);
                }
                TooltipHandler.TipRegion(SkillRequirementRect, pawns.NullOrEmpty() ? "PawnListEmpty_SMO".Translate(sb2) : "PawnList_SMO".Translate(sb));
            }
            GUI.EndGroup();
            SkillRequirementRect.x += 5f;
            SkillRequirementRect.y += 5f + (TabRect.height * num);
            bool mouseOnSkill = Mouse.IsOver(SkillRequirementRect);

            if (mouseOnSkill)
            {
                List <Pawn> pawns = cachedPawns.TryGetValue(objective.def);
                foreach (Pawn pawn in pawns)
                {
                    if (pawn != null)
                    {
                        TargetHighlighter.Highlight(pawn, false, true, false);
                    }
                }
            }
            if (Widgets.ButtonInvisible(TabRect, true))
            {
                if (mouseOnSkill)
                {
                    Find.Selector.SelectedObjects.Clear();
                    if (cachedPawns.TryGetValue(objective.def, out List <Pawn> pawns))
                    {
                        if (!pawns.NullOrEmpty())
                        {
                            CameraJumper.TryJumpAndSelect(pawns.RandomElement());
                            this.Close();
                        }
                    }
                }
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                SelectedObjective = objective;
            }
            TabRect = TabRect.ExpandedBy(5f);
            if (objective.CurrentState == MOState.Failed)
            {
                GUI.color = Color.red;
                Widgets.DrawHighlight(TabRect);
                GUI.color = Color.white;
            }
            bool mouseOver = Mouse.IsOver(TabRect);

            if (mouseOver || this.SelectedObjective == objective)
            {
                GUI.color = mouseOver ? new Color(0.3f, 0.3f, 0.3f) : new Color(0.5f, 0.5f, 0.5f);
                Widgets.DrawBox(TabRect, 1);
                GUI.color = Color.white;
            }
        }
Ejemplo n.º 4
0
        public override void DoWindowContents(Rect inRect)
        {
            float CurrentY = 0f;

            //Title
            Text.Font = GameFont.Medium;
            string  Title     = objective.def.LabelCap;
            Vector2 TitleSize = Text.CalcSize(Title);
            Rect    TitleRect = new Rect(new Vector2(0f, CurrentY), TitleSize);

            Widgets.Label(TitleRect, Title);
            Text.Font = GameFont.Small;
            CurrentY += TitleRect.height;

            Rect MainInfoBody = new Rect(0f, CurrentY, inRect.width, inRect.height - CurrentY);

            Widgets.DrawMenuSection(MainInfoBody);
            Rect MainInfoSub = MainInfoBody.ContractedBy(5f);

            CurrentY = 0f;
            GUI.BeginGroup(MainInfoSub);

            float tenth  = MainInfoSub.width * 0.1f;
            float middle = tenth * 5f;
            //Objective Type - State - Work - Time
            string  TypeLabel     = "OType_SMO".Translate() + ": " + (objective.def.type.ToString() + "_Label").Translate();
            Vector2 TypeLabelSize = Text.CalcSize(TypeLabel);
            Rect    TypeLabelRect = new Rect(new Vector2(5f, CurrentY), TypeLabelSize);

            string  StateLabel     = "OState_SMO".Translate() + ": " + (objective.CurrentState.ToString() + "_SMO").Translate();
            Vector2 StateLabelSize = Text.CalcSize(StateLabel);
            Rect    StateLabelRect = new Rect(new Vector2(middle, CurrentY), StateLabelSize);

            CurrentY += StateLabelRect.height + 5f;

            bool    workExists     = objective.def.workAmount > 0;
            string  WorkAmount     = "WorkAmount_SMO".Translate() + ": " + (workExists ? Math.Round(objective.GetWorkDone, 0) + "/" + objective.def.workAmount : "N/A");
            Vector2 WorkAmountSize = Text.CalcSize(WorkAmount);
            string  TimerLabel     = "Timer_SMO".Translate() + ": " + StoryUtils.GetTimerText(objective.GetTimer, objective.CurrentState);
            Vector2 TimerLabelSize = Text.CalcSize(TimerLabel);
            Rect    WorkAmountRect = new Rect(new Vector2(5f, CurrentY), WorkAmountSize);
            Rect    TimerLabelRect = new Rect(new Vector2(middle, CurrentY), TimerLabelSize);

            CurrentY += WorkAmountRect.height;

            Rect TSWTRect = new Rect(0f, TypeLabelRect.yMin, MainInfoSub.width, TypeLabelRect.height + WorkAmountRect.height + 5f);

            Widgets.DrawBoxSolid(TSWTRect, new ColorInt(33, 33, 33).ToColor);
            Widgets.Label(TypeLabelRect, TypeLabel);
            Widgets.Label(StateLabelRect, StateLabel);
            Widgets.Label(WorkAmountRect, WorkAmount);
            Widgets.Label(TimerLabelRect, TimerLabel);
            AddGap(MainInfoSub, ref CurrentY);

            //TravelSettings
            TravelSettings travelSettings = objective.def.travelSettings;
            float          width          = MainInfoSub.width - 10f;

            if (travelSettings != null)
            {
                TravelMode    mode            = travelSettings.mode;
                string        ModeLabel       = (mode.ToString() + "Travel_SMO").Translate();
                float         ModeLabelHeight = Text.CalcHeight(ModeLabel, width);
                Rect          ModeLabelRect   = new Rect(5f, CurrentY, width, ModeLabelHeight);
                Rect          BoxRect         = new Rect();
                List <string> factions        = new List <string>();
                List <string> factionCounts   = new List <string>();

                if (!travelSettings.factionSettings.factions.NullOrEmpty())
                {
                    foreach (FactionDef def in travelSettings.factionSettings.factions)
                    {
                        string label = def.LabelCap;
                        factions.Add(label);
                    }
                    foreach (FactionDef def in travelSettings.factionSettings.factions)
                    {
                        string label = def.LabelCap;
                        factionCounts.Add(label + ": " + objective.travelTracker.CountFor(def) + "/" + travelSettings.factionSettings.Value(mode));
                    }
                }

                if (mode == TravelMode.Reach || mode == TravelMode.Explore)
                {
                    float height = 4f * 25f;
                    BoxRect = new Rect(0f, CurrentY, MainInfoSub.width, height);
                    Widgets.DrawBoxSolid(BoxRect, new ColorInt(33, 33, 33).ToColor);
                    CurrentY += ModeLabelHeight + 5f;
                    var listing = new Listing_Standard(GameFont.Small);
                    listing.Begin(new Rect(5f, CurrentY, MainInfoSub.width - 10f, height));
                    listing.ColumnWidth = (MainInfoSub.width - 10f) * 0.5f;
                    //left side
                    string Distance = "TravelDistance_SMO".Translate(travelSettings.minDistance);
                    listing.Label(Distance, Text.CalcHeight(Distance, listing.ColumnWidth));
                    string Biome = "TileBiome_SMO".Translate() + ": " + (travelSettings.tileSettings.biome?.LabelCap ?? "N/A");
                    listing.Label(Biome, Text.CalcHeight(Biome, listing.ColumnWidth));
                    string River = "TileA_SMO".Translate() + " " + (travelSettings.tileSettings.river?.label ?? "N/A");
                    listing.Label(River, Text.CalcHeight(River, listing.ColumnWidth));
                    //right side
                    listing.NewColumn();
                    string Destination = "TravelDestination_SMO".Translate() + ": " + (travelSettings.destination?.label ?? "N/A");
                    listing.Label(Destination, Text.CalcHeight(Destination, listing.ColumnWidth));
                    string Road = "TileA_SMO".Translate() + " " + travelSettings.tileSettings.road?.label;
                    listing.Label(Road, Text.CalcHeight(Road, listing.ColumnWidth));
                    string Hilliness = "Tile_SMO".Translate() + " " + (travelSettings.tileSettings.hilliness.HasValue ? travelSettings.tileSettings.hilliness.Value.GetLabel() : "N/A");
                    listing.Label(Hilliness, Text.CalcHeight(Hilliness, listing.ColumnWidth));
                    listing.End();
                    CurrentY += (height - 23f);
                    Widgets.Label(ModeLabelRect, ModeLabel);
                }
                else if (mode == TravelMode.Trade)
                {
                    CurrentY += ModeLabelHeight;
                    Rect   ValueLabelRect = new Rect();
                    string ValueLabel     = "";
                    int    silver         = travelSettings.minSilver;
                    if (silver != 0)
                    {
                        ValueLabel = silver > 0 ? "TradeBuy_SMO".Translate(silver) : "TradeSell_SMO".Translate(-silver);
                        Vector2 ValueLabelSize = Text.CalcSize(ValueLabel);
                        ValueLabelRect = new Rect(new Vector2(5f, CurrentY), ValueLabelSize);
                        CurrentY      += ValueLabelSize.y;
                    }
                    BoxRect = new Rect(0f, ModeLabelRect.yMin, MainInfoSub.width, ModeLabelHeight + ValueLabelRect.height);
                    Widgets.DrawBoxSolid(BoxRect, new ColorInt(33, 33, 33).ToColor);
                    Widgets.Label(ModeLabelRect, ModeLabel);
                    Widgets.Label(ValueLabelRect, ValueLabel);
                    TryMakeTextList(MainInfoSub, ref CurrentY, "", factionCounts, false);
                }
                else
                {
                    TryMakeTextList(MainInfoSub, ref CurrentY, ModeLabel, factionCounts, false);
                }
                AddGap(MainInfoSub, ref CurrentY);
            }
            //ThingSettings
            ThingSettings thingSettings = objective.def.targetSettings?.thingSettings;

            if (thingSettings != null)
            {
                string ThingSettingLabel       = ResolveThingSettings();
                float  ThingSettingLabelHeight = Text.CalcHeight(ThingSettingLabel, width);
                Rect   ThingSettingLabelRect   = new Rect(5f, CurrentY, width, ThingSettingLabelHeight);
                CurrentY += ThingSettingLabelRect.height;

                string  stuff          = thingSettings.stuff?.LabelCap ?? "AnyStuff_SMO".Translate();
                string  StuffLabel     = "ThingSettingsStuff_SMO".Translate(stuff);
                Vector2 StuffLabelSize = Text.CalcSize(StuffLabel);
                Rect    StuffLabelRect = new Rect(new Vector2(5f, CurrentY), StuffLabelSize);

                string  qual             = thingSettings.minQuality?.GetLabel() ?? "Any_SMO".Translate();
                string  QualityLabel     = "ThingSettingsQuality_SMO".Translate(qual);
                Vector2 QualityLabelSize = Text.CalcSize(QualityLabel);
                Rect    QualityLabelRect = new Rect(new Vector2(middle, CurrentY), QualityLabelSize);
                CurrentY += QualityLabelRect.height;

                int     num          = objective.thingTracker?.GetThingCount >= thingSettings.minAmount ? thingSettings.minAmount : objective.thingTracker.GetThingCount;
                string  NumLabel     = "MapCheckCount_SMO".Translate(num + "/" + thingSettings.minAmount);
                Vector2 NumLabelSize = Text.CalcSize(NumLabel);
                Rect    NumLabelRect = new Rect(new Vector2(5f, CurrentY), NumLabelSize);
                CurrentY += NumLabelRect.height;

                Rect TSRect = new Rect(0f, ThingSettingLabelRect.yMin, width + 10f, ThingSettingLabelHeight + QualityLabelSize.y + NumLabelSize.y);
                Widgets.DrawBoxSolid(TSRect, new ColorInt(33, 33, 33).ToColor);
                Widgets.Label(ThingSettingLabelRect, ThingSettingLabel);
                Widgets.Label(StuffLabelRect, StuffLabel);
                Widgets.Label(QualityLabelRect, QualityLabel);
                Widgets.Label(NumLabelRect, NumLabel);

                AddGap(MainInfoSub, ref CurrentY);
            }

            //PawnSettings
            PawnSettings pawnSettings = objective.def.targetSettings?.pawnSettings;

            if (pawnSettings != null)
            {
                bool   humanlike          = pawnSettings.def?.race.Humanlike ?? false;
                string PawnDefLabel       = ResolvePawnSettings();
                float  PawnDefLabelHeight = Text.CalcHeight(PawnDefLabel, width);
                Rect   PawnDefLabelRect   = new Rect(5f, CurrentY, width, PawnDefLabelHeight);
                CurrentY += PawnDefLabelHeight;

                string  PawnKindDefLabel     = "PawnSettingsKind_SMO".Translate(pawnSettings.kindDef?.LabelCap ?? "N/A");
                Vector2 PawnKindDefLabelSize = Text.CalcSize(PawnKindDefLabel);
                Rect    PawnKindDefLabelRect = new Rect(new Vector2(5f, CurrentY), PawnKindDefLabelSize);

                string  FactionLabel     = "PawnSettingsFaction_SMO".Translate(pawnSettings.factionDef?.LabelCap ?? "N/A");
                Vector2 FactionLabelSize = Text.CalcSize(FactionLabel);
                Rect    FactionLabelRect = new Rect(new Vector2(middle, CurrentY), FactionLabelSize);
                CurrentY += PawnKindDefLabelSize.y;

                string  GenderLabel     = "PawnSettingsGender_SMO".Translate(pawnSettings.gender?.GetLabel(!humanlike) ?? "N/A");
                Vector2 GenderLabelSize = Text.CalcSize(GenderLabel);
                Rect    GenderLabelRect = new Rect(new Vector2(5f, CurrentY), GenderLabelSize);

                int     num          = objective.thingTracker?.GetPawnCount >= pawnSettings.minAmount ? pawnSettings.minAmount : objective.thingTracker.GetPawnCount;
                string  NumLabel     = "MapCheckCount_SMO".Translate(num + "/" + pawnSettings.minAmount);
                Vector2 NumLabelSize = Text.CalcSize(NumLabel);
                Rect    NumLabelRect = new Rect(new Vector2(middle, CurrentY), NumLabelSize);
                CurrentY += GenderLabelSize.y;

                Rect PawnSettingRect = new Rect(0f, PawnDefLabelRect.yMin, width + 10f, PawnDefLabelHeight + PawnKindDefLabelSize.y + GenderLabelSize.y);
                Widgets.DrawBoxSolid(PawnSettingRect, new ColorInt(33, 33, 33).ToColor);
                Widgets.Label(PawnDefLabelRect, PawnDefLabel);
                Widgets.Label(PawnKindDefLabelRect, PawnKindDefLabel);
                Widgets.Label(FactionLabelRect, FactionLabel);
                Widgets.Label(GenderLabelRect, GenderLabel);
                Widgets.Label(NumLabelRect, NumLabel);

                AddGap(MainInfoSub, ref CurrentY);
            }

            //Stations
            if (NeedsStation)
            {
                List <string> stations = new List <string>();
                foreach (ThingValue tv in objective.def.targetSettings?.targets)
                {
                    stations.Add(tv.ThingDef.LabelCap);
                }
                TryMakeTextList(MainInfoSub, ref CurrentY, "Stations_SMO".Translate(objective.def.BestPotentialStation.LabelCap), stations, true);
            }
            if (!objective.def.skillRequirements.NullOrEmpty())
            {
                List <string> skills = new List <string>();
                foreach (SkillRequirement sr in objective.def.skillRequirements)
                {
                    skills.Add(sr.Summary);
                }
                TryMakeTextList(MainInfoSub, ref CurrentY, "SkillRequirementsInfo_SMO".Translate(), skills, true);
            }

            float RestHeight     = MainInfoBody.ContractedBy(5f).height - CurrentY;
            float ContainerSplit = NeedsStation ? RestHeight * 0.5f : RestHeight / 3f;

            //Targets
            if (objective.def.targetSettings != null && objective.def.targetSettings.targets.Count > 0 && !NeedsStation)
            {
                float  TotalHeight     = objective.def.targetSettings.targets.Count * 34f;
                float  ContainerHeight = TotalHeight > ContainerSplit ? ContainerSplit : TotalHeight;
                Rect   ContainerRect   = new Rect(0f, CurrentY, MainInfoSub.width, ContainerHeight);
                string TargetDesc      = ResolveTargetText();
                if (!TargetDesc.NullOrEmpty())
                {
                    float TargetDescHeight = Text.CalcHeight(TargetDesc, MainInfoSub.width - 5f);
                    Rect  BoxRect          = new Rect(0f, CurrentY, MainInfoSub.width, TargetDescHeight + 10f);
                    Rect  TargetDescRect   = BoxRect.ContractedBy(5f);
                    ContainerRect.y += BoxRect.height + 5f;
                    CurrentY        += BoxRect.height + 5f;
                    if (TotalHeight > ContainerSplit)
                    {
                        ContainerRect.height -= BoxRect.height + 5f;
                    }
                    Widgets.DrawBoxSolid(BoxRect, new ColorInt(33, 33, 33).ToColor);
                    Widgets.Label(TargetDescRect, TargetDesc);
                }
                StoryUtils.DrawMenuSectionColor(ContainerRect, 1, new ColorInt(40, 40, 40), StoryMats.defaultBorder);
                GUI.BeginGroup(ContainerRect.ContractedBy(1));
                Widgets.BeginScrollView(new Rect(0f, 0f, ContainerRect.width, ContainerRect.height), ref TargetPos, new Rect(0f, 0f, ContainerRect.width, TotalHeight), false);
                float             CurY    = 5f;
                List <ThingValue> targets = objective.def.targetSettings.targets;
                for (int i = 0; i < targets.Count; i++)
                {
                    ThingValue   thingValue = targets[i];
                    ThingTracker tracker    = objective.thingTracker;
                    if (i % 2 == 0)
                    {
                        GUI.color = new Color(1f, 1f, 1f, 0.5f);
                        Widgets.DrawHighlight(new Rect(0f, CurY - 5f, ContainerRect.width, 34f));
                        GUI.color = Color.white;
                    }
                    string    label    = tracker.WorksWithPawns ? thingValue.PawnKindDef.LabelCap : thingValue.ThingDef.LabelCap;
                    WidgetRow itemRow  = new WidgetRow(5f, CurY);
                    WidgetRow infoRect = new WidgetRow(ContainerRect.width * 0.5f, CurY);
                    itemRow.Gap(10f);
                    GUI.color = ResolveColor(thingValue);
                    if ((thingValue.IsPawnKindDef && !thingValue.ThingDef.race.Humanlike) || thingValue.ThingDef != null)
                    {
                        if (thingValue.ThingDef.uiIcon != BaseContent.BadTex)
                        {
                            itemRow.Icon(thingValue.ThingDef.uiIcon);
                        }
                    }
                    GUI.color = Color.white;
                    itemRow.Label(label);
                    if (tracker.TargetsDone.TryGetValue(thingValue, out int value))
                    {
                        infoRect.Label(value.ToString() + "/" + thingValue.value);
                    }
                    CurY += 34f;
                }
                CurrentY += ContainerRect.height;
                Widgets.EndScrollView();
                GUI.EndGroup();
            }

            //Rewards
            float RewardContainerHeight     = ContainerSplit - 46f;
            List <IncidentProperties> props = new List <IncidentProperties>(objective.def.incidentsOnCompletion);

            if (objective.def.result != null)
            {
                props.Add(objective.def.result);
            }
            if (!props.NullOrEmpty())
            {
                if (props.Any(p => p.type == IncidentType.Reward))
                {
                    if (!props.NullOrEmpty() && props.Any(p => !p?.spawnSettings?.spawnList.NullOrEmpty() ?? false))
                    {
                        float TotalHeight          = props.Sum(s => s.spawnSettings.spawnList.Count) * 34f;
                        float height               = TotalHeight > ContainerSplit ? ContainerSplit : TotalHeight;
                        Rect  CompletedRewardsRect = new Rect(0f, CurrentY, MainInfoSub.width, height);
                        CurrentY += CompletedRewardsRect.height;
                        DrawRewardContainer(CompletedRewardsRect, "CompletedRewards_SMO".Translate(), ref RewardCompletedPos, props);
                    }
                }
                props = objective.def.incidentsOnFail;
                if (props.Any(p => p.type == IncidentType.Reward))
                {
                    if (!props.NullOrEmpty() && props.Any(p => !p?.spawnSettings?.spawnList.NullOrEmpty() ?? false))
                    {
                        float total             = props.Sum(s => s.spawnSettings.spawnList.Count) * 34f;
                        float height            = total > ContainerSplit ? ContainerSplit : total;
                        Rect  FailedRewardsRect = new Rect(0f, CurrentY, MainInfoSub.width, height);
                        CurrentY += FailedRewardsRect.height;
                        DrawRewardContainer(FailedRewardsRect, "FailedRewards_SMO".Translate(), ref RewardFailedPos, props);
                    }
                }
            }
            GUI.EndGroup();
        }