コード例 #1
0
        private static void DoRow(Rect rect, Pawn pawn, Caravan caravan, ref Pawn specificNeedsTabForPawn, bool doNeeds)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, pawn, caravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, pawn);
            rect2.width -= 24f;
            if (!pawn.Dead)
            {
                CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn);
                rect2.width -= 24f;
            }
            Widgets.DrawHighlightIfMouseover(rect2);
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect3, pawn);
            Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f);

            GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            if (doNeeds)
            {
                GetNeedsToDisplay(pawn, tmpNeeds);
                float xMax = bgRect.xMax;
                for (int i = 0; i < tmpNeeds.Count; i++)
                {
                    Need      need = tmpNeeds[i];
                    int       maxThresholdMarkers = 0;
                    bool      doTooltip           = true;
                    Rect      rect4 = new Rect(xMax, 0f, 100f, 50f);
                    Need_Mood mood  = need as Need_Mood;
                    if (mood != null)
                    {
                        maxThresholdMarkers = 1;
                        doTooltip           = false;
                        if (Mouse.IsOver(rect4))
                        {
                            TooltipHandler.TipRegion(rect4, new TipSignal(() => CustomMoodNeedTooltip(mood), rect4.GetHashCode()));
                        }
                    }
                    need.DrawOnGUI(rect4, maxThresholdMarkers, 10f, drawArrows: false, doTooltip);
                    xMax = rect4.xMax;
                }
            }
            if (pawn.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
コード例 #2
0
        public static void DoNeeds(Rect rect, Pawn pawn)
        {
            UpdateDisplayNeeds(pawn);
            float num    = 0f;
            float height = 45f;

            for (int i = 0; i < displayNeeds.Count; i++)
            {
                Need need  = displayNeeds[i];
                Rect rect2 = new Rect(rect.x, rect.y + num, rect.width, height);
                need.DrawOnGUI(rect2);
                num += height;
            }
        }
コード例 #3
0
        private static void DoRow(Rect rect, Thing thing, CompVehicle vehicle, ref Pawn specificNeedsTabForPawn, bool doNeeds)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();
            Pawn pawn  = thing as Pawn;

            //if (listingUsesAbandonSpecificCountButtons)
            //{
            //    if (thing.stackCount != 1)
            //    {
            //        CaravanPeopleAndItemsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan);
            //    }
            //    rect2.width -= 24f;
            //}
            //CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, thing, caravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, thing);
            rect2.width -= 24f;
            if (pawn != null && !pawn.Dead)
            {
                CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, pawn, ref specificNeedsTabForPawn);
                rect2.width -= 24f;
            }
            if (pawn == null)
            {
                Rect rect3 = rect2;
                rect3.xMin = rect3.xMax - 60f;
                CaravanPeopleAndItemsTabUtility.TryDrawMass(thing, rect3);
                rect2.width -= 60f;
            }
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect4 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect4, thing, 1f);
            if (pawn != null)
            {
                Rect bgRect = new Rect(rect4.xMax + 4f, 16f, 100f, 18f);
                GenMapUI.DrawPawnLabel(pawn, bgRect, 1f, 100f, null, GameFont.Small, false, false);
                if (doNeeds)
                {
                    GetNeedsToDisplay(pawn, tmpNeeds);
                    float xMax = bgRect.xMax;
                    for (int i = 0; i < tmpNeeds.Count; i++)
                    {
                        Need need = tmpNeeds[i];
                        int  maxThresholdMarkers = 0;
                        bool doTooltip           = true;
                        Rect rect5 = new Rect(xMax, 0f, 100f, 50f);
#pragma warning disable IDE0019 // Use pattern matching
                        Need_Mood mood = need as Need_Mood;
#pragma warning restore IDE0019 // Use pattern matching
                        if (mood != null)
                        {
                            maxThresholdMarkers = 1;
                            doTooltip           = false;
                            //TooltipHandler.TipRegion(rect5, new TipSignal(() => CaravanPeopleAndItemsTabUtility.CustomMoodNeedTooltip(mood), rect5.GetHashCode()));
                        }
                        need.DrawOnGUI(rect5, maxThresholdMarkers, 10f, false, doTooltip);
                        xMax = rect5.xMax;
                    }
                }
                if (pawn.Downed)
                {
                    GUI.color = new Color(1f, 0f, 0f, 0.5f);
                    Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                    GUI.color = Color.white;
                }
            }
            else
            {
                Rect rect6 = new Rect(rect4.xMax + 4f, 0f, 300f, 30f);
                Text.Anchor   = TextAnchor.MiddleLeft;
                Text.WordWrap = false;
                Widgets.Label(rect6, thing.LabelCap);
                Text.Anchor   = TextAnchor.UpperLeft;
                Text.WordWrap = true;
            }
            GUI.EndGroup();
        }