Ejemplo n.º 1
0
        private static void DrawPawnRow(float y, float width, SocialCardUtility.CachedSocialTabEntry entry, Pawn selPawnForSocialInfo)
        {
            float rowHeight = SocialCardUtility.GetRowHeight(entry, width, selPawnForSocialInfo);
            Rect  rect      = new Rect(0f, y, width, rowHeight);
            Pawn  otherPawn = entry.otherPawn;

            if (Mouse.IsOver(rect))
            {
                GUI.color = SocialCardUtility.HighlightColor;
                GUI.DrawTexture(rect, TexUI.HighlightTex);
            }
            TooltipHandler.TipRegion(rect, () => SocialCardUtility.GetPawnRowTooltip(entry, selPawnForSocialInfo), entry.otherPawn.thingIDNumber * 13 + selPawnForSocialInfo.thingIDNumber);
            if (Widgets.ButtonInvisible(rect, false))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    if (otherPawn.Dead)
                    {
                        Messages.Message("MessageCantSelectDeadPawn".Translate(new object[]
                        {
                            otherPawn.LabelShort
                        }).CapitalizeFirst(), MessageTypeDefOf.RejectInput, false);
                    }
                    else if (otherPawn.SpawnedOrAnyParentSpawned || otherPawn.IsCaravanMember())
                    {
                        CameraJumper.TryJumpAndSelect(otherPawn);
                    }
                    else
                    {
                        Messages.Message("MessageCantSelectOffMapPawn".Translate(new object[]
                        {
                            otherPawn.LabelShort
                        }).CapitalizeFirst(), MessageTypeDefOf.RejectInput, false);
                    }
                }
                else if (Find.GameInitData.startingAndOptionalPawns.Contains(otherPawn))
                {
                    Page_ConfigureStartingPawns page_ConfigureStartingPawns = Find.WindowStack.WindowOfType <Page_ConfigureStartingPawns>();
                    if (page_ConfigureStartingPawns != null)
                    {
                        page_ConfigureStartingPawns.SelectPawn(otherPawn);
                        SoundDefOf.RowTabSelect.PlayOneShotOnCamera(null);
                    }
                }
            }
            float width2;
            float width3;
            float width4;
            float width5;
            float width6;

            SocialCardUtility.CalculateColumnsWidths(width, out width2, out width3, out width4, out width5, out width6);
            Rect rect2 = new Rect(5f, y + 3f, width2, rowHeight - 3f);

            SocialCardUtility.DrawRelationLabel(entry, rect2, selPawnForSocialInfo);
            Rect rect3 = new Rect(rect2.xMax, y + 3f, width3, rowHeight - 3f);

            SocialCardUtility.DrawPawnLabel(otherPawn, rect3);
            Rect rect4 = new Rect(rect3.xMax, y + 3f, width4, rowHeight - 3f);

            SocialCardUtility.DrawMyOpinion(entry, rect4, selPawnForSocialInfo);
            Rect rect5 = new Rect(rect4.xMax, y + 3f, width5, rowHeight - 3f);

            SocialCardUtility.DrawHisOpinion(entry, rect5, selPawnForSocialInfo);
            Rect rect6 = new Rect(rect5.xMax, y + 3f, width6, rowHeight - 3f);

            SocialCardUtility.DrawPawnSituationLabel(entry.otherPawn, rect6, selPawnForSocialInfo);
        }