Ejemplo n.º 1
0
        private static void DoRow(Rect rect, TransferableImmutable thing, Caravan caravan)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            if (thing.TotalStackCount != 1)
            {
                CaravanThingsTabUtility.DoAbandonSpecificCountButton(rect2, thing, caravan);
            }
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoAbandonButton(rect2, thing, caravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, thing.AnyThing);
            rect2.width -= 24f;
            Rect rect3 = rect2;

            rect3.xMin = rect3.xMax - 60f;
            CaravanThingsTabUtility.DrawMass(thing, rect3);
            rect2.width -= 60f;
            Widgets.DrawHighlightIfMouseover(rect2);
            Rect rect4 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect4, thing.AnyThing, 1f);
            Rect rect5 = new Rect(rect4.xMax + 4f, 0f, 300f, 30f);

            Text.Anchor   = TextAnchor.MiddleLeft;
            Text.WordWrap = false;
            Widgets.Label(rect5, thing.LabelCapWithTotalStackCount.Truncate(rect5.width, null));
            Text.Anchor   = TextAnchor.UpperLeft;
            Text.WordWrap = true;
            GUI.EndGroup();
        }
Ejemplo n.º 2
0
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref specificSocialTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

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

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
Ejemplo n.º 3
0
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref specificHealthTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

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

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            float num = bgRect.xMax;

            if (!compactMode)
            {
                if (p.RaceProps.IsFlesh)
                {
                    Rect rect4 = new Rect(num, 0f, 100f, 50f);
                    DoPain(rect4, p);
                }
                num += 100f;
                List <PawnCapacityDef> list = CapacitiesToDisplay;
                for (int i = 0; i < list.Count; i++)
                {
                    Rect rect5 = new Rect(num, 0f, 100f, 50f);
                    if ((p.RaceProps.Humanlike && !list[i].showOnHumanlikes) || (p.RaceProps.Animal && !list[i].showOnAnimals) || (p.RaceProps.IsMechanoid && !list[i].showOnMechanoids) || !PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i]))
                    {
                        num += 100f;
                        continue;
                    }
                    DoCapacity(rect5, p, list[i]);
                    num += 100f;
                }
            }
            if (!compactMode)
            {
                Vector2 vector = new Vector2(num + 8f, 13f);
                Widgets.Checkbox(vector, ref p.health.beCarriedByCaravanIfSick, 24f, disabled: false, paintable: true);
                TooltipHandler.TipRegionByKey(new Rect(vector, new Vector2(24f, 24f)), "BeCarriedIfSickTip");
                num += 40f;
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
Ejemplo n.º 4
0
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref this.specificHealthTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

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

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, false, false);
            if (!this.compactMode)
            {
                float num = bgRect.xMax;
                if (p.RaceProps.IsFlesh)
                {
                    Rect rect4 = new Rect(num, 0f, 100f, 50f);
                    this.DoPain(rect4, p);
                }
                List <PawnCapacityDef> list = this.CapacitiesToDisplay;
                for (int i = 0; i < list.Count; i++)
                {
                    num += 100f;
                    Rect rect5 = new Rect(num, 0f, 100f, 50f);
                    if (!p.RaceProps.Humanlike || list[i].showOnHumanlikes)
                    {
                        if (!p.RaceProps.Animal || list[i].showOnAnimals)
                        {
                            if (!p.RaceProps.IsMechanoid || list[i].showOnMechanoids)
                            {
                                if (PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i]))
                                {
                                    this.DoCapacity(rect5, p, list[i]);
                                }
                            }
                        }
                    }
                }
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
        public static void DrawMass(TransferableImmutable transferable, Rect rect)
        {
            float num = 0f;

            for (int i = 0; i < transferable.things.Count; i++)
            {
                num += transferable.things[i].GetStatValue(StatDefOf.Mass, true) * (float)transferable.things[i].stackCount;
            }
            CaravanThingsTabUtility.DrawMass(num, rect);
        }
Ejemplo n.º 6
0
        private void DoPawnRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            bool flag = this.draggedItem != null && rect2.Contains(Event.current.mousePosition) && this.CurrentWearerOf(this.draggedItem) != p;

            if ((Mouse.IsOver(rect2) && this.draggedItem == null) || flag)
            {
                Widgets.DrawHighlight(rect2);
            }
            if (flag && this.droppedDraggedItem)
            {
                this.TryEquipDraggedItem(p);
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

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

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, false, false);
            float xMax = bgRect.xMax;

            if (p.equipment != null)
            {
                List <ThingWithComps> allEquipmentListForReading = p.equipment.AllEquipmentListForReading;
                for (int i = 0; i < allEquipmentListForReading.Count; i++)
                {
                    this.DoEquippedGear(allEquipmentListForReading[i], p, ref xMax);
                }
            }
            if (p.apparel != null)
            {
                WITab_Caravan_Gear.tmpApparel.Clear();
                WITab_Caravan_Gear.tmpApparel.AddRange(p.apparel.WornApparel);
                WITab_Caravan_Gear.tmpApparel.SortBy((Apparel x) => x.def.apparel.LastLayer.drawOrder, (Apparel x) => - x.def.apparel.HumanBodyCoverage);
                for (int j = 0; j < WITab_Caravan_Gear.tmpApparel.Count; j++)
                {
                    this.DoEquippedGear(WITab_Caravan_Gear.tmpApparel[j], p, ref xMax);
                }
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
Ejemplo n.º 7
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();
        }
        public static void DrawMass(Thing thing, Rect rect)
        {
            float mass = thing.GetStatValue(StatDefOf.Mass, true) * (float)thing.stackCount;

            CaravanThingsTabUtility.DrawMass(mass, rect);
        }