Beispiel #1
0
        public float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY, bool showBloodLoss)
        {
            curY     += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Status".Translate(), true, TextAnchor.UpperLeft);
            curY     += 4f;
            Text.Font = GameFont.Small;
            float bleedingRate = pawn.health.hediffSet.BleedingRate;

            if ((double)bleedingRate > 0.01)
            {
                string rightLabel = string.Concat(new string[]
                {
                    bleedingRate.ToStringPercent(),
                    "/",
                    "Day".Translate()
                });
                curY = this.DrawLeftRow(leftRect, curY, "BleedingRate".Translate(), rightLabel, HealthCardUtility.GetBleedingRateColor(bleedingRate), null);
            }
            if (pawn.def.race.isFlesh)
            {
                Pair <string, Color> painLabel = RimWorld.HealthCardUtility.GetPainLabel(pawn);
                string tipLabel = "PainLevel".Translate() + ": " + (pawn.health.hediffSet.Pain * 100f).ToString("F0") + "%";
                curY = this.DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, tipLabel);
            }
            if (!pawn.Dead)
            {
                IEnumerable <PawnCapacityDef> source;
                if (pawn.def.race.Humanlike)
                {
                    source = from x in DefDatabase <PawnCapacityDef> .AllDefs
                             where x.showOnHumanlikes
                             select x;
                }
                else if (pawn.def.race.Animal)
                {
                    source = from x in DefDatabase <PawnCapacityDef> .AllDefs
                             where x.showOnAnimals
                             select x;
                }
                else
                {
                    source = from x in DefDatabase <PawnCapacityDef> .AllDefs
                             where x.showOnMechanoids
                             select x;
                }
                foreach (PawnCapacityDef current in from act in source
                         orderby act.listOrder
                         select act)
                {
                    if (PawnCapacityUtility.BodyCanEverDoActivity(pawn.RaceProps.body, current))
                    {
                        Pair <string, Color> efficiencyLabel = RimWorld.HealthCardUtility.GetEfficiencyLabel(pawn, current);
                        string tipLabel2 = "Efficiency".Translate() + ": " + (pawn.health.capacities.GetEfficiency(current) * 100f).ToString("F0") + "%";
                        curY = this.DrawLeftRow(leftRect, curY, current.GetLabelFor(pawn.RaceProps.isFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, tipLabel2);
                    }
                }
            }
            curY += 16f;
            curY += TabDrawer.DrawHeader(0f, curY, leftRect.width, "EdB.Injuries".Translate(), true, TextAnchor.UpperLeft);
            curY += 4f;
            Rect position = new Rect(leftRect.x, curY, leftRect.width, leftRect.height - curY);

            GUI.BeginGroup(position);
            Rect outRect  = new Rect(0f, 0f, position.width, position.height);
            Rect viewRect = new Rect(0f, 0f, position.width - 16f, HealthCardUtility.scrollViewHeight);
            Rect rect     = new Rect(position.x, position.y, position.width - 16f, position.height);

            GUI.color = Color.white;
            Widgets.BeginScrollView(outRect, ref HealthCardUtility.scrollPosition, viewRect);
            float num = 0f;

            HealthCardUtility.highlight = true;
            bool flag = false;

            foreach (IGrouping <BodyPartRecord, Hediff> current2 in ((IEnumerable <IGrouping <BodyPartRecord, Hediff> >) this.visibleHediffGroupsInOrderMethod.Invoke(null, new object[]
            {
                pawn,
                showBloodLoss
            })))
            {
                flag = true;
                this.DrawHediffRow(rect, pawn, current2, ref num);
            }
            if (!flag)
            {
                GUI.color   = Color.gray;
                Text.Anchor = TextAnchor.UpperCenter;
                Widgets.Label(new Rect(0f, 0f, position.width, 30f), new GUIContent("NoInjuries".Translate()));
                Text.Anchor = TextAnchor.UpperLeft;
            }
            if (Event.current.type == EventType.Layout)
            {
                HealthCardUtility.scrollViewHeight = num;
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
            GUI.color = Color.white;
            return(curY);
        }
Beispiel #2
0
        protected override void FillTab()
        {
            Pawn pawnToShowInfoAbout = this.PawnToShowInfoAbout;

            try
            {
                GUI.BeginGroup(new Rect(ITab_Pawn_Character_Alternate.PaddingSize.x, ITab_Pawn_Character_Alternate.PaddingSize.y, ITab_Pawn_Character_Alternate.ContentSize.x, ITab_Pawn_Character_Alternate.ContentSize.y));
                float num         = 0f;
                float num2        = 12f;
                bool  allowRename = !pawnToShowInfoAbout.Dead && !pawnToShowInfoAbout.Destroyed;
                num      += TabDrawer.DrawNameAndBasicInfo(0f, num, this.PawnToShowInfoAbout, ITab_Pawn_Character_Alternate.ContentSize.x, allowRename);
                num      += num2;
                num      += TabDrawer.DrawHeader(0f, num, ITab_Pawn_Character_Alternate.ContentSize.x, "Backstory".Translate(), true, TextAnchor.UpperLeft);
                num      += 2f;
                Text.Font = GameFont.Small;
                GUI.color = TabDrawer.TextColor;
                Vector2     vector     = new Vector2(ITab_Pawn_Character_Alternate.ContentSize.x, 24f);
                Vector2     vector2    = new Vector2(90f, 24f);
                Vector2     vector3    = new Vector2(3f, 2f);
                int         num3       = 0;
                IEnumerator enumerator = Enum.GetValues(typeof(BackstorySlot)).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        BackstorySlot backstorySlot = (BackstorySlot)enumerator.Current;
                        Rect          rect          = new Rect(0f, num, vector.x, vector.y);
                        if (rect.Contains(Event.current.mousePosition))
                        {
                            Widgets.DrawHighlight(rect);
                        }
                        TooltipHandler.TipRegion(rect, pawnToShowInfoAbout.story.GetBackstory(backstorySlot).FullDescriptionFor(pawnToShowInfoAbout));
                        rect.x     += vector3.x;
                        rect.width -= vector3.x * 2f;
                        rect.y     += vector3.y;
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        string str = (backstorySlot == BackstorySlot.Adulthood) ? "Adulthood".Translate() : "Childhood".Translate();
                        Widgets.Label(rect, str + ":");
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;
                        Rect   rect2 = new Rect(rect.x + vector2.x, rect.y, vector.x - vector2.x, vector.y);
                        string title = pawnToShowInfoAbout.story.GetBackstory(backstorySlot).title;
                        Widgets.Label(rect2, title);
                        num += vector.y + 2f;
                        num3++;
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                num -= 6f;
                num += num2;
                num += TabDrawer.DrawHeader(0f, num, ITab_Pawn_Character_Alternate.ContentSize.x, "Skills".Translate(), true, TextAnchor.UpperLeft);
                num += 6f;
                float height = (float)DefDatabase <SkillDef> .AllDefs.Count <SkillDef>() * 24f;

                Rect position = new Rect(0f, num, 390f, height);
                GUI.color = TabDrawer.TextColor;
                GUI.BeginGroup(position);
                this.skillDrawer.DrawSkillsOf(pawnToShowInfoAbout, new Vector2(0f, 0f));
                GUI.EndGroup();
                num += position.height;
                num += num2;
                float num4 = num;
                float num5 = ITab_Pawn_Character_Alternate.ContentSize.x * 0.4f - ITab_Pawn_Character_Alternate.PaddingSize.x / 2f;
                float num6 = ITab_Pawn_Character_Alternate.ContentSize.x * 0.6f - ITab_Pawn_Character_Alternate.PaddingSize.x / 2f;
                float left = num5 + ITab_Pawn_Character_Alternate.PaddingSize.x;
                num += TabDrawer.DrawHeader(0f, num, num5, "IncapableOf".Translate(), true, TextAnchor.UpperLeft);
                num += 4f;
                Vector2 vector4 = new Vector2(num5, 22f);
                Text.Font = GameFont.Small;
                GUI.color = TabDrawer.TextColor;
                List <WorkTags> list = pawnToShowInfoAbout.story.DisabledWorkTags.ToList <WorkTags>();
                GUI.skin.label.alignment = TextAnchor.UpperLeft;
                if (list.Count == 0)
                {
                    Rect rect3 = new Rect(0f, num, num5, vector4.y);
                    GUI.color = TabDrawer.SeparatorColor;
                    Widgets.Label(rect3, "NoneLower".Translate());
                    GUI.color = TabDrawer.TextColor;
                    num      += rect3.height - 1f;
                }
                else
                {
                    foreach (WorkTags current in list)
                    {
                        Rect rect4 = new Rect(0f, num, num5, vector4.y);
                        Widgets.Label(rect4, current.LabelTranslated());
                        num += vector4.y - 1f;
                    }
                }
                num  = num4;
                num += TabDrawer.DrawHeader(left, num, num6, "Traits".Translate(), true, TextAnchor.UpperLeft);
                num += 4f;
                Vector2 vector5 = new Vector2(num6, 22f);
                Text.Font = GameFont.Small;
                GUI.color = TabDrawer.TextColor;
                float num7 = 0f;
                foreach (Trait current2 in pawnToShowInfoAbout.story.traits.allTraits)
                {
                    num7 += vector5.y + 2f;
                    Rect rect5 = new Rect(left, num, num6, vector5.y);
                    if (rect5.Contains(Event.current.mousePosition))
                    {
                        Widgets.DrawHighlight(rect5);
                    }
                    rect5.x += 2f;
                    Widgets.Label(rect5, current2.LabelCap);
                    TooltipHandler.TipRegion(rect5, current2.TipString(pawnToShowInfoAbout));
                    num += vector5.y - 1f;
                }
            }
            finally
            {
                GUI.EndGroup();
            }
            if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value && pawnToShowInfoAbout != null)
            {
                BrowseButtonDrawer.DrawBrowseButtons(this.size, pawnToShowInfoAbout);
            }
            GUI.color = Color.white;
        }
Beispiel #3
0
        protected override void FillTab()
        {
            Text.Font = GameFont.Small;
            Rect rect     = new Rect(0f, 8f, this.size.x, this.size.y - 8f);
            Rect rect2    = rect.ContractedBy(24f);
            Rect position = new Rect(rect2.x, rect2.y, rect2.width, rect2.height - 24f);

            try
            {
                GUI.BeginGroup(position);
                Text.Font = GameFont.Small;
                GUI.color = Color.white;
                Rect outRect  = new Rect(0f, 0f, position.width, position.height);
                Rect viewRect = new Rect(0f, 0f, position.width - 16f, this.scrollViewHeight);
                Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);
                float num  = 0f;
                bool  flag = false;
                if (this.SelPawnForGear.equipment != null)
                {
                    num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Equipment".Translate(), true, TextAnchor.UpperLeft);
                    foreach (ThingWithComps current in this.SelPawnForGear.equipment.AllEquipment)
                    {
                        this.DrawThingRow(ref num, viewRect.width, current);
                        flag = true;
                    }
                    if (!flag)
                    {
                        num += 4f;
                        Rect rect3 = new Rect(0f, num, viewRect.width, 24f);
                        GUI.color = TabDrawer.SeparatorColor;
                        Widgets.Label(rect3, "NoneLower".Translate());
                        GUI.color = TabDrawer.TextColor;
                        num      += ITab_Pawn_Gear_Alternate.LineHeight;
                    }
                }
                flag = false;
                if (this.SelPawnForGear.apparel != null)
                {
                    num += 10f;
                    num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Apparel".Translate(), true, TextAnchor.UpperLeft);
                    num += 4f;
                    foreach (Apparel current2 in from ap in this.SelPawnForGear.apparel.WornApparel
                             orderby ap.def.apparel.bodyPartGroups[0].listOrder descending
                             select ap)
                    {
                        this.DrawThingRow(ref num, viewRect.width, current2);
                        flag = true;
                    }
                    if (!flag)
                    {
                        num += 4f;
                        Rect rect4 = new Rect(0f, num, viewRect.width, 24f);
                        GUI.color = TabDrawer.SeparatorColor;
                        Widgets.Label(rect4, "NoneLower".Translate());
                        GUI.color = TabDrawer.TextColor;
                        num      += ITab_Pawn_Gear_Alternate.LineHeight;
                    }
                }
                flag = false;
                if (this.SelPawnForGear.inventory != null)
                {
                    num += 10f;
                    num += TabDrawer.DrawHeader(0f, num, viewRect.width, "Inventory".Translate(), true, TextAnchor.UpperLeft);
                    foreach (Thing current3 in this.SelPawnForGear.inventory.container)
                    {
                        this.DrawThingRow(ref num, viewRect.width, current3);
                        flag = true;
                    }
                    if (!flag)
                    {
                        num += 4f;
                        Rect rect5 = new Rect(0f, num, viewRect.width, 24f);
                        GUI.color = TabDrawer.SeparatorColor;
                        Widgets.Label(rect5, "NoneLower".Translate());
                        GUI.color = TabDrawer.TextColor;
                        num      += ITab_Pawn_Gear_Alternate.LineHeight;
                    }
                }
                if (Event.current.type == EventType.Layout)
                {
                    this.scrollViewHeight = num + 8f;
                }
                Widgets.EndScrollView();
            }
            finally
            {
                GUI.EndGroup();
            }
            if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value)
            {
                Pawn selPawnForGear = this.SelPawnForGear;
                if (selPawnForGear != null)
                {
                    BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawnForGear);
                }
            }
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
        }