Пример #1
0
        private static void DrawPawnRow(float y, float width, CachedSocialTabEntry entry, Pawn selPawnForSocialInfo)
        {
            float rowHeight = GetRowHeight(entry, width, selPawnForSocialInfo);
            Rect  rect      = new Rect(0f, y, width, rowHeight);
            Pawn  otherPawn = entry.otherPawn;

            if (Mouse.IsOver(rect))
            {
                GUI.color = HighlightColor;
                GUI.DrawTexture(rect, TexUI.HighlightTex);
            }
            if (Mouse.IsOver(rect))
            {
                TooltipHandler.TipRegion(rect, () => GetPawnRowTooltip(entry, selPawnForSocialInfo), entry.otherPawn.thingIDNumber * 13 + selPawnForSocialInfo.thingIDNumber);
            }
            if (Widgets.ButtonInvisible(rect))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    if (otherPawn.Dead)
                    {
                        Messages.Message("MessageCantSelectDeadPawn".Translate(otherPawn.LabelShort, otherPawn).CapitalizeFirst(), MessageTypeDefOf.RejectInput, historical: false);
                    }
                    else if (otherPawn.SpawnedOrAnyParentSpawned || otherPawn.IsCaravanMember())
                    {
                        CameraJumper.TryJumpAndSelect(otherPawn);
                    }
                    else
                    {
                        Messages.Message("MessageCantSelectOffMapPawn".Translate(otherPawn.LabelShort, otherPawn).CapitalizeFirst(), MessageTypeDefOf.RejectInput, historical: 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();
                    }
                }
            }
            CalculateColumnsWidths(width, out var relationsWidth, out var pawnLabelWidth, out var myOpinionWidth, out var hisOpinionWidth, out var pawnSituationLabelWidth);
            Rect rect2 = new Rect(5f, y + 3f, relationsWidth, rowHeight - 3f);

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

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

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

            DrawHisOpinion(entry, rect5, selPawnForSocialInfo);
            DrawPawnSituationLabel(rect: new Rect(rect5.xMax, y + 3f, pawnSituationLabelWidth, rowHeight - 3f), pawn: entry.otherPawn, selPawnForSocialInfo: selPawnForSocialInfo);
        }
Пример #2
0
        private static void DrawPawnRow(float y, float width, 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(otherPawn.LabelShort).CapitalizeFirst(), MessageTypeDefOf.RejectInput);
                    }
                    else if (otherPawn.SpawnedOrAnyParentSpawned || otherPawn.IsCaravanMember())
                    {
                        CameraJumper.TryJumpAndSelect(otherPawn);
                    }
                    else
                    {
                        Messages.Message("MessageCantSelectOffMapPawn".Translate(otherPawn.LabelShort).CapitalizeFirst(), MessageTypeDefOf.RejectInput);
                    }
                }
                else if (Find.GameInitData.startingPawns.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 = default(float);
            float width3 = default(float);
            float width4 = default(float);
            float width5 = default(float);
            float width6 = default(float);

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

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

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

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

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

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