Ejemplo n.º 1
0
        private void DrawRewardContainer(Rect rect, string label, ref Vector2 pos, List <IncidentProperties> properties)
        {
            properties = properties.FindAll(p => p.type == IncidentType.Reward);
            Vector2 LabelSize = Text.CalcSize(label);
            Rect    LabelRect = new Rect(new Vector2(5f, rect.y), LabelSize);

            Widgets.Label(LabelRect, label);

            rect = new Rect(rect.x, rect.y + 22f, rect.width, rect.height);
            StoryUtils.DrawMenuSectionColor(new Rect(rect.x, rect.y + 24f, rect.width, rect.height), 1, new ColorInt(40, 40, 40), StoryMats.defaultBorder);

            List <ThingValue> things      = ThingsFromIncidents(properties);
            float             TotalHeight = things.Count * 34f;
            Rect UpperTab = new Rect(rect.x, rect.y, rect.width, 24f);

            StoryUtils.DrawMenuSectionColor(UpperTab, 1, new ColorInt(40, 40, 40), StoryMats.defaultBorder);
            float tenth = UpperTab.width * 0.1f;

            float itemPos = UpperTab.x += 5f;

            Widgets.Label(UpperTab, "Item_SMO".Translate());
            float ChancePos = UpperTab.x += tenth * 8.5f;

            Widgets.Label(UpperTab, "Chance_SMO".Translate());
            Rect ContainerRect = new Rect(rect.x, UpperTab.yMax, rect.width, rect.height + 2f).ContractedBy(1f);

            GUI.BeginGroup(ContainerRect);
            Widgets.BeginScrollView(new Rect(0f, 0f, ContainerRect.width, ContainerRect.height), ref pos, new Rect(0f, 0f, ContainerRect.width, TotalHeight), false);
            float CurY = 5f;

            for (int i = 0; i < things.Count; i++)
            {
                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;
                }
                ThingValue thingValue = things[i];
                ThingDef   thingDef   = thingValue.ThingDef;
                WidgetRow  itemRow    = new WidgetRow(itemPos, CurY);
                GUI.color = ResolveColor(thingValue);
                itemRow.Icon(thingValue.ThingDef.uiIcon);
                GUI.color = Color.white;
                string qualityLabel = !thingDef.CountAsResource ? " (" + thingValue.QualityCategory.GetLabel() + ")" : "";
                float  LabelY       = itemRow.Label((thingValue.ResolvedStuff == null ? "" : thingValue.ResolvedStuff.LabelCap + " ") + thingDef.LabelCap + qualityLabel + " (x" + thingValue.value + ")").y;
                itemRow.Gap(ChancePos - itemRow.FinalX);
                itemRow.Label(thingValue.chance.ToStringPercent());
                CurY += 34f;
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
        }
        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.º 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 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.º 5
0
        public void DrawLockedMissionInfo(Rect rect)
        {
            Rect InfoRect = new Rect(rect.x, rect.y, rect.width / 3f, rect.height);

            StoryUtils.DrawMenuSectionColor(InfoRect, 1, new ColorInt(55, 55, 55), new ColorInt(135, 135, 135));
            float TotalHeight = InfoHeightFor(InfoRect.width, selectedLockedMission);
            Rect  ViewRect    = new Rect(InfoRect.x, InfoRect.y, InfoRect.width, TotalHeight);

            Widgets.BeginScrollView(InfoRect, ref missionInfoScrollPos, ViewRect, false);
            InfoRect = InfoRect.ContractedBy(5f);
            GUI.BeginGroup(InfoRect);
            //MainPart
            float      CurY           = 0f;
            Requisites requisites     = selectedLockedMission.requisites;
            string     MainInfo       = requisites.anyList ? "MissionInfoMainAny_SMO".Translate("'" + selectedLockedMission.label + "'") : "MissionInfoMain_SMO".Translate("'" + selectedLockedMission.label + "'");
            float      MainInfoHeight = Text.CalcHeight(MainInfo, InfoRect.width);
            Rect       MainInfoRect   = new Rect(0, 0, InfoRect.width, MainInfoHeight);

            Widgets.Label(MainInfoRect, MainInfo);
            CurY += MainInfoRect.height;

            GeneralInfo(new Rect(0f, CurY, InfoRect.width, 0f), ref CurY, requisites.researchProjects, requisites.anyResearch ? "MissionInfoResearchAny_SMO".Translate() : "MissionInfoResearch_SMO".Translate(), delegate(ResearchProjectDef def)
            {
                Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Research, true);
                MainTabWindow_Research window = (Find.WindowStack.Windows.Where(w => w is MainTabWindow_Research).FirstOrDefault() as MainTabWindow_Research);
                Traverse.Create(window).Field("selectedProject").SetValue(def);
            });
            GeneralInfo(new Rect(0f, CurY, InfoRect.width, 0f), ref CurY, requisites.missions, requisites.anyMission ? "MissionInfoMissionsAny_SMO".Translate() : "MissionInfoMissions_SMO".Translate(), delegate(MissionDef def)
            {
                SelectedMission       = StoryManager.GetMission(def);
                selectedLockedMission = null;
            });
            GeneralInfo(new Rect(0f, CurY, InfoRect.width, 0f), ref CurY, requisites.objectives, requisites.anyObjective ? "MissionInfoObjectivesAny_SMO".Translate() : "MissionInfoObjectives_SMO".Translate(), delegate(ObjectiveDef def)
            {
                SelectedMission       = StoryManager.GetMission(def);
                SelectedObjective     = SelectedMission.objectives.Find(o => o.def == def);
                selectedLockedMission = null;
            });
            GeneralInfo(new Rect(0f, CurY, InfoRect.width, 0f), ref CurY, requisites.things, requisites.anyThing ? "MissionInfoThingsAny_SMO".Translate() : "MissionInfoThings_SMO".Translate(), null, delegate(Rect selection, ThingValue tv)
            {
                ThingDef thingDef   = tv.ThingDef;
                string stuffLabel   = tv.Stuff != null ? tv.ResolvedStuff.LabelCap : "Any_SMO".Translate();
                string qualityLabel = !thingDef.CountAsResource ? tv.CustomQuality ? " (" + tv.QualityCategory.GetLabel() + ")" : "" : "";
                string fullLabel    = "  - " + (tv.ResolvedStuff != null ? stuffLabel + " " : "") + thingDef.LabelCap + qualityLabel + " (x" + tv.value + ")";
                Vector2 labelSize   = Text.CalcSize(fullLabel);
                bool oversized      = labelSize.x > selection.width;
                string label        = oversized ? "  - " + tv.ThingDef.LabelCap + "(...)" : fullLabel;
                Widgets.Label(selection, label);
                if (oversized)
                {
                    TooltipHandler.TipRegion(selection, fullLabel);
                }
            });
            GeneralInfo(new Rect(0f, CurY, InfoRect.width, 0f), ref CurY, requisites.jobs, "MissionInfoJobs_SMO".Translate(), null, delegate(Rect selection, JobDef def)
            {
                string label = "  ..." + def.reportString;
                Widgets.Label(selection, label);
            });
            GUI.EndGroup();
            Widgets.EndScrollView();
        }
Ejemplo n.º 6
0
        public void DrawMissionMenu(Rect inRect)
        {
            //Draw Tabs
            Text.Font = GameFont.Small;
            Rect    tabRect  = new Rect(inRect.x + 10f, inRect.y - 20f, inRect.width - 30f, 20f);
            string  missions = "Missions_SMO".Translate();
            string  themes   = "Themes_SMO".Translate();
            string  locked   = "LockedTab_SMO".Translate();
            Vector2 v1       = Text.CalcSize(missions);
            Vector2 v2       = Text.CalcSize(themes);
            Vector2 v3       = Text.CalcSize(locked);

            v1.x += 6;
            v2.x += 6;
            v3.x += 6;
            Rect missionTab   = new Rect(new Vector2(tabRect.x, tabRect.y), v1);
            Rect themeTab     = new Rect(new Vector2(missionTab.xMax, missionTab.y), v2);
            Rect lockedButton = new Rect(new Vector2(themeTab.xMax, themeTab.y), v3);

            Text.Anchor = TextAnchor.MiddleCenter;
            StoryUtils.DrawMenuSectionColor(missionTab, 1, StoryMats.defaultFill, StoryMats.defaultBorder);
            Widgets.Label(missionTab, missions);
            StoryUtils.DrawMenuSectionColor(themeTab, 1, StoryMats.defaultFill, StoryMats.defaultBorder);
            Widgets.Label(themeTab, themes);
            float    opacity = Mouse.IsOver(lockedButton) ? 1f : 0.5f;
            ColorInt border  = showLocked ? new ColorInt(142, 200, 154, (int)(255f * opacity)) : new ColorInt(243, 153, 123, (int)(255f * opacity));

            StoryUtils.DrawMenuSectionColor(lockedButton, 1, StoryMats.defaultFill, border);
            if (Widgets.ButtonInvisible(lockedButton, true))
            {
                showLocked = !showLocked;
                if (!showLocked)
                {
                    SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
                    selectedLockedMission = null;
                }
                else
                {
                    SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
                }
            }
            Widgets.Label(lockedButton, locked);
            GUI.color = new Color(0.8f, 0.8f, 0.8f);
            if (Widgets.ButtonInvisible(missionTab))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                TabFlag = true;
            }
            if (Mouse.IsOver(missionTab) || TabFlag)
            {
                Widgets.DrawBox(missionTab, 1);
            }
            if (Widgets.ButtonInvisible(themeTab))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                TabFlag = false;
            }
            if (Mouse.IsOver(themeTab) || !TabFlag)
            {
                Widgets.DrawBox(themeTab, 1);
            }
            GUI.color = Color.white;

            StoryUtils.DrawMenuSectionColor(inRect, 1, new ColorInt(55, 55, 55), new ColorInt(135, 135, 135));
            Rect rect = inRect.ContractedBy(5f);

            float selectionHeight = 45f;
            float viewHeight      = 0f;
            float selectionYPos   = 0f;

            if (TabFlag)
            {
                //Mission Tab
                GUI.BeginGroup(rect);
                viewHeight = MissionTabHeight(selectionHeight);
                Rect outRect  = new Rect(0f, 0f, rect.width, rect.height);
                Rect viewRect = new Rect(0f, 0f, rect.width, viewHeight);
                Widgets.BeginScrollView(outRect, ref StoryManager.missionScrollPos, viewRect, false);
                for (int i = 0; i < StoryManager.ModFolder.Count; i++)
                {
                    ModContentPackWrapper MCPW = StoryManager.ModFolder[i];
                    if (MCPW.SCD != SCD.MainStoryControlDef)
                    {
                        List <Mission> Missions = MissionsForMod(MCPW.MCP);
                        //Identifier
                        string  appendix       = MCPW.Toggled ? "-" : "+";
                        string  identifier     = MCPW.SCD.label + " " + appendix;
                        Vector2 identifierSize = Text.CalcSize(identifier);
                        identifierSize.x += 6f;
                        Rect identifierRect = new Rect(new Vector2(0f, selectionYPos), identifierSize);
                        selectionYPos += identifierRect.height;
                        Widgets.DrawMenuSection(identifierRect);
                        Text.Font   = GameFont.Tiny;
                        Text.Anchor = TextAnchor.MiddleCenter;
                        Widgets.Label(identifierRect, identifier);
                        Text.Anchor = 0;
                        Text.Font   = GameFont.Small;
                        if (Widgets.ButtonInvisible(identifierRect) && MCPW.HasActiveMissions)
                        {
                            MCPW.Toggle();
                            if (MCPW.Toggled)
                            {
                                SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
                            }
                            else
                            {
                                SoundDefOf.TabClose.PlayOneShotOnCamera(null);
                            }
                        }
                        if (Mouse.IsOver(identifierRect))
                        {
                            GUI.color = new Color(0.8f, 0.8f, 0.8f);
                            Widgets.DrawBox(identifierRect, 1);
                            GUI.color = Color.white;
                        }
                        UIHighlighter.HighlightOpportunity(identifierRect, MCPW.MCP.Identifier + "-StoryHighlight");

                        if (MCPW.Toggled)
                        {
                            //Group
                            float      lockedCount  = 0;
                            string     lockedLabel  = "";
                            Vector2    lockedSize   = Vector2.zero;
                            List <Def> cachedLocked = new List <Def>();
                            if (showLocked)
                            {
                                cachedLocked = MCPW.MCP.AllDefs.Where(d => d is MissionDef && !(d as MissionDef).HardLocked && (d as MissionDef).CurrentState == MOState.Inactive).ToList();
                                lockedCount  = cachedLocked.Count();
                                lockedLabel  = "Locked_SMO".Translate() + ":";
                                lockedSize   = Text.CalcSize(lockedLabel);
                            }
                            bool  lockedBool = lockedCount > 0;
                            float height     = (lockedCount + Missions.Count) * selectionHeight + (lockedBool ? lockedSize.y : 0f);
                            Rect  groupRect  = new Rect(0f, selectionYPos, rect.width, height);
                            StoryUtils.DrawMenuSectionColor(groupRect, 1, MCPW.SCD.color, MCPW.SCD.borderColor);
                            float missionTabY = groupRect.y;
                            for (int ii = 0; ii < Missions.Count; ii++)
                            {
                                Mission         mission = Missions[ii];
                                Rect            rect4   = new Rect(groupRect.x, missionTabY, groupRect.width, selectionHeight);
                                StoryControlDef scd     = StoryManager.Theme != null ? StoryManager.Theme.SCD : SCD.MainStoryControlDef;
                                DrawMissionTab(rect4, mission, scd, ii);
                                missionTabY += selectionHeight;
                            }
                            if (showLocked && lockedBool)
                            {
                                float h       = height - (Missions.Count * selectionHeight);
                                Rect  boxRect = new Rect(groupRect.x, groupRect.y + (height - h), groupRect.width, h);
                                Widgets.DrawBoxSolid(boxRect.ContractedBy(2f), new Color(0.2f, 0.2f, 0.2f, 0.2f));
                                GUI.color = MCPW.SCD.borderColor.ToColor;
                                Widgets.DrawLineHorizontal(boxRect.x, boxRect.y, boxRect.width);
                                GUI.color = Color.white;
                                Widgets.Label(new Rect(new Vector2(groupRect.x + 5f, missionTabY), lockedSize), lockedLabel);
                                missionTabY += lockedSize.y;
                                foreach (MissionDef def in cachedLocked)
                                {
                                    Rect rect4 = new Rect(groupRect.x, missionTabY, groupRect.width, selectionHeight);
                                    DrawLockedMissionTab(rect4, def, MCPW.SCD);
                                    missionTabY += selectionHeight;
                                }
                            }
                            selectionYPos += height;
                        }
                    }
                    selectionYPos += 5f;
                }
                Widgets.EndScrollView();
                GUI.EndGroup();
            }
            else
            {
                //Theme Tab
                GUI.BeginGroup(rect);
                viewHeight = selectionHeight * StoryManager.ModFolder.Count;
                Rect outRect  = new Rect(0f, 0f, rect.width, rect.height);
                Rect viewRect = new Rect(0f, 0f, rect.width, viewHeight);
                Widgets.BeginScrollView(outRect, ref StoryManager.missionScrollPos, viewRect, false);
                for (int i = 0; i < StoryManager.ModFolder.Count + 1; i++)
                {
                    Rect selection = new Rect(0f, selectionYPos, rect.width, selectionHeight).ContractedBy(5f);
                    Text.Anchor = TextAnchor.MiddleCenter;
                    if (i == 0)
                    {
                        Widgets.DrawMenuSection(selection);
                        Widgets.Label(selection, "None");
                        if (Mouse.IsOver(selection) || StoryManager.Theme == null)
                        {
                            GUI.color = new Color(0.8f, 0.8f, 0.8f);
                            Widgets.DrawBox(selection, 1);
                            GUI.color = Color.white;
                            if (Widgets.ButtonInvisible(selection))
                            {
                                UpdateTheme(null);
                                SoundDefOf.Click.PlayOneShotOnCamera(null);
                            }
                        }
                    }
                    else
                    {
                        ModContentPackWrapper mcp = StoryManager.ModFolder.ElementAt(i - 1);
                        if (mcp.SCD != SCD.MainStoryControlDef ? mcp.SCD.backGroundPath != SCD.MainStoryControlDef.backGroundPath : true)
                        {
                            Widgets.DrawMenuSection(selection);
                            Widgets.Label(selection, mcp.SCD.LabelCap);
                            if (Mouse.IsOver(selection) || StoryManager.Theme == mcp)
                            {
                                GUI.color = new Color(0.8f, 0.8f, 0.8f);
                                Widgets.DrawBox(selection, 1);
                                GUI.color = Color.white;
                                if (Widgets.ButtonInvisible(selection, true))
                                {
                                    UpdateTheme(mcp.MCP);
                                    SoundDefOf.Click.PlayOneShotOnCamera(null);
                                }
                            }
                        }
                    }
                    Text.Anchor    = 0;
                    selectionYPos += selectionHeight;
                }
                Widgets.EndScrollView();
                GUI.EndGroup();
            }
        }
Ejemplo n.º 7
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();
        }