Exemplo n.º 1
0
        private void FillTabGuest(Listing_Standard listingStandard, Rect rect)
        {
            //ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);

            var trust = SelPawn.RelativeTrust();

            {
                var tryImprove = SelPawn.ImproveRelationship();
                var tryRecruit = SelPawn.TryRecruit();

                listingStandard.ColumnWidth = size.x - 20;

                var comp = SelPawn.GetComp <CompGuest>();
                if (comp != null)
                {
                    listingStandard.Gap();

                    CheckboxLabeled(listingStandard, "ImproveRelationship".Translate(), ref tryImprove);
                    CheckboxLabeled(listingStandard, "ShouldTryToRecruit".Translate(), ref tryRecruit);

                    comp.chat    = tryImprove;
                    comp.recruit = tryRecruit;

                    listingStandard.Gap(50);

                    DrawSetDefaultButton(rect);
                }

                if (SelPawn.Faction != null)
                {
                    listingStandard.Label(txtRecruitmentPenalty + ": " + SelPawn.RecruitPenalty().ToString("##0"));
                    listingStandard.Label(txtFactionGoodwill + ": " + SelPawn.Faction.PlayerGoodwill.ToString("##0"));
                }
                listingStandard.Gap();

                // Will only have squadBrain while "checked in", becomes null again when guests leave
                var squadBrain = SelPawn.GetLord();
                if (squadBrain != null)
                {
                    listingStandard.Label(string.Format("{0}:", txtRecruitmentChance));
                    listingStandard.Slider(Mathf.Clamp(trust, 0, 100), 0, 100);
                    if (trust < 50)
                    {
                        var color = GUI.color;
                        GUI.color = Color.red;
                        listingStandard.Label("TrustTooLow".Translate().AdjustedFor(SelPawn));
                        GUI.color = color;
                    }

                    var lordToil = squadBrain.CurLordToil as LordToil_VisitPoint;
                    if (lordToil != null && SelPawn.Faction != null)
                    {
                        listingStandard.Label(txtHospitality + ":");
                        listingStandard.Slider(lordToil.GetVisitScore(SelPawn), 0f, 1f);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override void UpdateSize()
 {
     base.UpdateSize();
     size = GetSize(SelPawn?.GetComp <CompVehicle>()?.AllOccupants, PaneTopY, true);
     if (size.x + SpecificNeedsTabWidth > UI.screenWidth)
     {
         doNeeds = false;
         size    = GetSize(SelPawn?.GetComp <CompVehicle>().AllOccupants, PaneTopY, false);
     }
     else
     {
         doNeeds = true;
     }
     size.y = Mathf.Max(size.y, NeedsCardUtility.FullSize.y);
 }
Exemplo n.º 3
0
        private void FillTabGuest(Rect rect)
        {
            //ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);
            var title            = SelPawn.royalty?.MostSeniorTitle;
            var isRoyal          = title != null;
            var friends          = isRoyal ? SelPawn.GetFriendsSeniorityInColony() : SelPawn.GetFriendsInColony();
            var friendsRequired  = isRoyal ? RequiredSeniority : RequiredFriends;
            var friendPercentage = 100f * friends / friendsRequired;


            var tryImprove     = SelPawn.ImproveRelationship();
            var tryMakeFriends = SelPawn.MakeFriends();

            listingStandard.ColumnWidth = size.x - 20;

            var comp = SelPawn.GetComp <CompGuest>();

            // If the lord is not on the map it's invalid!
            if (comp?.lord != null && comp.lord.ownedPawns.Contains(SelPawn) && SelPawn.Map.lordManager.lords.Contains(comp.lord))
            {
                listingStandard.Gap();
                string labelStay     = "AreaToStay".Translate();
                string labelBuy      = "AreaToBuy".Translate();
                var    rectStayLabel = listingStandard.GetRect(Text.CalcHeight(labelStay, listingStandard.ColumnWidth));
                var    rectStay      = listingStandard.GetRect(24);
                var    rectBuyLabel  = listingStandard.GetRect(Text.CalcHeight(labelBuy, listingStandard.ColumnWidth));
                var    rectBuy       = listingStandard.GetRect(24);

                LabelWithTooltip(labelStay, "AreaToStayTooltip".Translate(), rectStayLabel);
                GenericUtility.DoAreaRestriction(SelPawn, rectStay, comp.GuestArea, SetAreaRestriction, AreaUtility.AreaAllowedLabel_Area);
                LabelWithTooltip(labelBuy, "AreaToBuyTooltip".Translate(), rectBuyLabel);
                GenericUtility.DoAreaRestriction(SelPawn, rectBuy, comp.ShoppingArea, SetAreaShopping, GenericUtility.GetShoppingLabel);

                var rectImproveRelationship = listingStandard.GetRect(Text.LineHeight);
                CheckboxLabeled(listingStandard, "ImproveRelationship".Translate(), ref tryImprove, rectImproveRelationship, false, txtImproveTooltip);
                var rectMakeFriends = listingStandard.GetRect(Text.LineHeight);
                CheckboxLabeled(listingStandard, "MakeFriends".Translate(), ref tryMakeFriends, rectMakeFriends, false, txtMakeFriendsTooltip);

                comp.SetEntertain(tryImprove);
                comp.SetMakeFriends(tryMakeFriends);

                listingStandard.Gap(50);

                var mayRecruitAtAll = !SelPawn.InMentalState && comp.arrived;

                var rectSetDefault = new Rect(rect.xMax - buttonSize.x - 10, 160, buttonSize.x, buttonSize.y);
                var rectSendHome   = new Rect(rect.xMin - 10, 160, buttonSize.x, buttonSize.y);
                DrawButton(() => SetAllDefaults(SelPawn), txtMakeDefault, rectSetDefault, txtMakeDefaultTooltip);
                DrawButton(() => SendHomeDialog(SelPawn.GetLord()), txtSendAway, rectSendHome, txtSendAwayTooltip);
                if (mayRecruitAtAll)
                {
                    var rectRecruitButton = new Rect(rect.xMin - 10 + 10 + buttonSize.x, 160, buttonSize.x, buttonSize.y);
                    if (friends >= friendsRequired)
                    {
                        DrawButton(() => RecruitDialog(SelPawn, false), txtRecruit, rectRecruitButton, txtRecruitTooltip);
                    }
                    else if (!isRoyal)
                    {
                        DrawButton(() => RecruitDialog(SelPawn, true), txtForceRecruit, rectRecruitButton, txtForceRecruitTooltip);
                    }
                }

                // Highlight defaults
                if (Mouse.IsOver(rectSetDefault))
                {
                    Widgets.DrawHighlight(rectStay);
                    Widgets.DrawHighlight(rectStayLabel);
                    Widgets.DrawHighlight(rectBuy);
                    Widgets.DrawHighlight(rectBuyLabel);
                    Widgets.DrawHighlight(rectImproveRelationship);
                    Widgets.DrawHighlight(rectMakeFriends);
                }
            }

            if (SelPawn.Faction != null)
            {
                listingStandard.Label(txtRecruitmentPenalty.Translate(SelPawn.RecruitPenalty().ToString("##0"), SelPawn.ForcedRecruitPenalty().ToString("##0")));
                listingStandard.Label(txtFactionGoodwill + ": " + SelPawn.Faction.PlayerGoodwill.ToString("##0"));
            }

            listingStandard.Gap();

            if (isRoyal)
            {
                listingStandard.Label($"{"SeniorityRequirement".Translate(friends / 100, friendsRequired / 100)}:");
            }
            else
            {
                listingStandard.Label($"{"FriendsRequirement".Translate(friends, friendsRequired)}:");
            }

            listingStandard.Slider(Mathf.Clamp(friendPercentage, 0, 100), 0, 100);
            if (friendPercentage <= 99)
            {
                // Remove color from AdjustedFor and then Colorize
                listingStandard.Label(ColoredText.StripTags("NotEnoughFriends".Translate(SelPawn.GetMinRecruitOpinion()).AdjustedFor(SelPawn)).Colorize(Color.red));
            }
            else
            {
                listingStandard.Label("CanNowBeRecruited".Translate().AdjustedFor(SelPawn));
            }


            // Will only have score while "checked in", becomes 0 again when guest leaves
            if (SelPawn.GetVisitScore(out var score))
            {
                listingStandard.Label(txtHospitality + ":");
                listingStandard.Slider(score, 0f, 1f);
            }
        }
Exemplo n.º 4
0
        private void FillTabGuest(Rect rect)
        {
            //ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);

            var   friends          = SelPawn.GetFriendsInColony();
            var   friendsRequired  = GuestUtility.FriendsRequired(SelPawn.MapHeld) + SelPawn.GetEnemiesInColony();
            float friendPercentage = 100f * friends / friendsRequired;

            {
                var mayBuy     = SelPawn.MayBuy();
                var tryImprove = SelPawn.ImproveRelationship();
                var tryRecruit = SelPawn.TryRecruit();

                listingStandard.ColumnWidth = size.x - 20;

                var comp = SelPawn.GetComp <CompGuest>();
                if (comp != null)
                {
                    listingStandard.Gap();

                    DoAreaRestriction(listingStandard, comp);

                    CheckboxLabeled(listingStandard, "MayBuy".Translate(), ref mayBuy);
                    CheckboxLabeled(listingStandard, "ImproveRelationship".Translate(), ref tryImprove);

                    CheckboxLabeled(listingStandard, "ShouldTryToRecruit".Translate(), ref tryRecruit);

                    comp.mayBuy  = mayBuy;
                    comp.chat    = tryImprove;
                    comp.recruit = tryRecruit;

                    listingStandard.Gap(50);

                    DrawSetDefaultButton(rect);
                    DrawSendHomeButton(rect);
                }

                if (SelPawn.Faction != null)
                {
                    listingStandard.Label(txtRecruitmentPenalty + ": " + SelPawn.RecruitPenalty().ToString("##0"));
                    listingStandard.Label(txtFactionGoodwill + ": " + SelPawn.Faction.PlayerGoodwill.ToString("##0"));
                }
                listingStandard.Gap();

                listingStandard.Label(string.Format("{0}:", "FriendsRequirement".Translate(friends, friendsRequired)));

                listingStandard.Slider(Mathf.Clamp(friendPercentage, 0, 100), 0, 100);
                if (friendPercentage <= 99)
                {
                    var color = GUI.color;
                    GUI.color = Color.red;
                    listingStandard.Label("NotEnoughFriends".Translate(SelPawn.GetMinRecruitOpinion()).AdjustedFor(SelPawn));
                    GUI.color = color;
                }
                else
                {
                    listingStandard.Label("CanNowBeRecruited".Translate().AdjustedFor(SelPawn));
                }


                // Will only have squadBrain while "checked in", becomes null again when guests leave
                var squadBrain = SelPawn.GetLord();
                if (squadBrain != null)
                {
                    var lordToil = squadBrain.CurLordToil as LordToil_VisitPoint;
                    if (lordToil != null && SelPawn.Faction != null)
                    {
                        listingStandard.Label(txtHospitality + ":");
                        listingStandard.Slider(lordToil.GetVisitScore(SelPawn), 0f, 1f);
                    }
                }
            }
        }
Exemplo n.º 5
0
 protected override void FillTab()
 {
     DoRows(size, SelPawn?.GetComp <CompVehicle>(), ref scrollPosition, ref scrollViewHeight, false,
            ref specificNeedsTabForPawn, doNeeds);
 }